我有一个非常奇怪的问题。我构建了一个具有一些服务引用的连接的程序。 直到昨天它仍然运作良好。我不知道发生了什么,现在当我尝试与这些服务进行通信时,它给了我错误
System.InvalidOperationException: Could not find default endpoint element that references contract 'DateMovementRetrievalServiceProduction.DateMovementRetrievalPortType' in the service model client ServiceModel section. This might be because no configuaration file was found for your application or because no end point element matching this contract could be found in the client element
in System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
in System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
in System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
in System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
in System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
in System.ServiceModel.ConfigurationEndpointTrait`1.CreateSimplexFactory()
in System.ServiceModel.ConfigurationEndpointTrait`1.CreateChannelFactory()
in System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
in System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
in System.ServiceModel.ClientBase`1..ctor()
in WcfWsClient.DateMovementRetrievalServiceProduction.DateMovementRetrievalPortTypeClient..ctor() in \IcisNet.WcfWsClient\Service References\DateMovementRetrievalServiceProduction\Reference.cs:line 837
in IcisNet.WcfWsClient.DateMovementRetrievalProductionClient.RetrieveDateMovements(IcisNetSecurityToken token, DateTime dateFrom, DateTime dateTo, DomainRolesIcisNet domainRole, DomainsIcisNet domain) in IcisNet.WcfWsClient\DateMovementRetrievalProductionClient.cs:line 15
in IE.Forms.IcisNetStatusForm.GetIcisNetMessagesByDates() in IE.Forms\IcisNetStatusForm.cs:line 120
我不知道这是否正确翻译错误,因为我在希腊语中有例外。 有趣的是,该程序在visual studio debbuging下运行正常,但只有当我从\ debug \文件夹运行可执行文件时才会出现异常。
我试图从bitbucket反向提交,但它仍然给我这个错误。如果我从以前的版本运行可执行文件,它可以正常工作。
在DateMovementRetrievalServiceProduction \ Reference.cs第833-855行
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class DateMovementRetrievalPortTypeClient : System.ServiceModel.ClientBase<Ektelonistis.IcisNet.WcfWsClient.DateMovementRetrievalServiceProduction.DateMovementRetrievalPortType>, Ektelonistis.IcisNet.WcfWsClient.DateMovementRetrievalServiceProduction.DateMovementRetrievalPortType {
public DateMovementRetrievalPortTypeClient() {
}
public DateMovementRetrievalPortTypeClient(string endpointConfigurationName) :
base(endpointConfigurationName) {
}
public DateMovementRetrievalPortTypeClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public DateMovementRetrievalPortTypeClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public DateMovementRetrievalPortTypeClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress) {
}
在文件DateMovementRetrievalProductionClient.cs第8-18行 public class DateMovementRetrievalProductionClient:IDateMovementRetrievalServiceContract { #region实现IDateMovementRetrievalServiceContract
public List<RetrieveMovementInfo> RetrieveDateMovements(IcisNetSecurityToken token, DateTime dateFrom, DateTime dateTo,
DomainRolesIcisNet domainRole, DomainsIcisNet domain)
{
using (DateMovementRetrievalPortTypeClient client = new DateMovementRetrievalPortTypeClient())
{
//Production enviroment force TLS 1.2
.
.
.
并在文件IcisNetStatusForm.cs第110-120行
IDateMovementRetrievalServiceContract client = DateMovementRetrievalFactory.
GetDateMovementRetrievalService(
Parameters.Config.IsTestService ? MessageServiceType.Test : MessageServiceType.Production);
string afm = DefaultDiasafistis.DiasafistisDefault.Afm;
if ((int)lookUpEditEvrosAnazitisis.EditValue == 1 &&
lookUpEditPelates.EditValue != null)
afm = lookUpEditPelates.EditValue.ToString();
List<RetrieveMovementInfo> movementInfos = client.RetrieveDateMovements(new IcisNetSecurityToken
最后因为我搜索了为什么会出现这个问题并且大部分答案都说它与app.config有关,这是我的app.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MyConfigBinding" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
<binding name="TimeServiceImplPortBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="TimeServiceImplPortBinding1" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<customBinding>
<binding name="MessageProcessorPortBinding">
<security defaultAlgorithmSuite="Default" authenticationMode="UserNameOverTransport" requireDerivedKeys="true" includeTimestamp="true" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
<secureConversationBootstrap />
</security>
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap11" writeEncoding="utf-8">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpsTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="2147483647" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" requireClientCertificate="false" />
</binding>
<binding name="MovementRetrievalPortBinding">
<security defaultAlgorithmSuite="Default" authenticationMode="UserNameOverTransport" requireDerivedKeys="true" securityHeaderLayout="Lax" includeTimestamp="true" keyEntropyMode="CombinedEntropy" messageSecurityVersion="Default">
<secureConversationBootstrap />
</security>
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap11" writeEncoding="utf-8">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpsTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="2147483647" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" requireClientCertificate="false" />
</binding>
<binding name="DateMovementRetrievalPortBinding">
<security defaultAlgorithmSuite="Default" authenticationMode="UserNameOverTransport" requireDerivedKeys="true" securityHeaderLayout="Lax" includeTimestamp="true" keyEntropyMode="CombinedEntropy" messageSecurityVersion="Default">
<secureConversationBootstrap />
</security>
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap11" writeEncoding="utf-8">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpsTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="2147483647" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" requireClientCertificate="false" />
</binding>
<binding name="MessageProcessorPortBinding1">
<security defaultAlgorithmSuite="Default" authenticationMode="UserNameOverTransport" requireDerivedKeys="true" includeTimestamp="true" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
<secureConversationBootstrap />
</security>
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap11" writeEncoding="utf-8">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpsTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="2147483647" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" requireClientCertificate="false" />
</binding>
<binding name="MovementRetrievalPortBinding1">
<security defaultAlgorithmSuite="Default" authenticationMode="UserNameOverTransport" requireDerivedKeys="true" securityHeaderLayout="Lax" includeTimestamp="true" keyEntropyMode="CombinedEntropy" messageSecurityVersion="Default">
<secureConversationBootstrap />
</security>
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap11" writeEncoding="utf-8">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpsTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="2147483647" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" requireClientCertificate="false" />
</binding>
<binding name="DateMovementRetrievalPortBinding1">
<security defaultAlgorithmSuite="Default" authenticationMode="UserNameOverTransport" requireDerivedKeys="true" securityHeaderLayout="Lax" includeTimestamp="true" keyEntropyMode="CombinedEntropy" messageSecurityVersion="Default">
<secureConversationBootstrap />
</security>
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap11" writeEncoding="utf-8">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpsTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="2147483647" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" requireClientCertificate="false" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint bindingConfiguration="MyConfigBinding" name="SignInvoice" address="http://localhost:8731/SignHere" binding="basicHttpBinding" contract="Sign.Contracts.ISignDocument" />
<endpoint address="https://www2.gsis.gr:443/wsicisnet/MessageProcessorService" binding="customBinding" bindingConfiguration="MessageProcessorPortBinding" contract="MessageProcessorServiceTest.MessageProcessorPortType" name="MessageProcessorPort" />
<endpoint address="https://www2.gsis.gr:443/wsicisnet/MovementRetrievalService" binding="customBinding" bindingConfiguration="MovementRetrievalPortBinding" contract="MovementRetrievalServiceTest.MovementRetrievalPortType" name="MovementRetrievalPort" />
<endpoint address="https://www2.gsis.gr:443/wsicisnet/DateMovementRetrievalService" binding="customBinding" bindingConfiguration="DateMovementRetrievalPortBinding" contract="DateMovementRetrievalServiceTest.DateMovementRetrievalPortType" name="DateMovementRetrievalPort" />
<endpoint address="https://www1.gsis.gr:443/wsicisnet/MessageProcessorService" binding="customBinding" bindingConfiguration="MessageProcessorPortBinding1" contract="MessageProcessorServiceProduction.MessageProcessorPortType" name="MessageProcessorPort1" />
<endpoint address="https://www1.gsis.gr:443/wsicisnet/MovementRetrievalService" binding="customBinding" bindingConfiguration="MovementRetrievalPortBinding1" contract="MovementRetrievalServiceProduction.MovementRetrievalPortType" name="MovementRetrievalPort1" />
<endpoint address="https://www1.gsis.gr:443/wsicisnet/DateMovementRetrievalService" binding="customBinding" bindingConfiguration="DateMovementRetrievalPortBinding1" contract="DateMovementRetrievalServiceProduction.DateMovementRetrievalPortType" name="DateMovementRetrievalPort1" />
<endpoint address="https://www2.gsis.gr:443/wsicisnet/TimeService" binding="basicHttpBinding" bindingConfiguration="TimeServiceImplPortBinding" contract="TimeServiceTest.TimeServiceImpl" name="TimeServiceImplPort" />
<endpoint address="https://www1.gsis.gr:443/wsicisnet/TimeService" binding="basicHttpBinding" bindingConfiguration="TimeServiceImplPortBinding1" contract="TimeServiceProduction.TimeServiceImpl" name="TimeServiceImplPort1" />
</client>
</system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" /></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.29.0" newVersion="2.2.29.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
答案 0 :(得分:0)
好的,我发现了问题。 它与app.config或程序中的任何内容无关。 问题在于我用来锁定程序的程序,并且由于某种原因它阻止了与服务的通信。 谢谢大家的时间