Wcf 调用操作:EndpointDispatcher上的ContractFilter不匹配
我花了几个小时研究这个问题。我试图让WCF服务运行,现在它归结为一个ContractFilter不匹配错误,操作为“”。以下是客户端配置的相关部分:Wcf 调用操作:EndpointDispatcher上的ContractFilter不匹配,wcf,web-config,net.tcp,Wcf,Web Config,Net.tcp,我花了几个小时研究这个问题。我试图让WCF服务运行,现在它归结为一个ContractFilter不匹配错误,操作为“”。以下是客户端配置的相关部分: <bindings> <netTcpBinding> <binding name="netTcpBindingConfig_TimeRegistrationSystemService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647
<bindings>
<netTcpBinding>
<binding name="netTcpBindingConfig_TimeRegistrationSystemService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
<binding name="netTcpBindingConfig_SystemService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://mysrv.myteam.local:54520/MyCompany.Services.TimeRegistrationSystemService.svc" binding="netTcpBinding" bindingConfiguration="netTcpBindingConfig_SystemService" contract="SystemService.ISystemService" name="NetTcpBindingBinding_ISystemService" />
<endpoint address="net.tcp://mysrv.myteam.local:54520/MyCompany.Services.SystemService.svc" binding="netTcpBinding" bindingConfiguration="netTcpBindingConfig_TimeRegistrationSystemService" contract="TimeRegistrationSystemService.ITimeRegistrationSystemService" name="NetTcpBindingBinding_ITimeRegistrationSystemService" />
</client>
这里是服务器的配置绑定配置:
<bindings>
<netTcpBinding>
<binding name="netTcpBindingConfig_OtherInterfaceService">
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
<binding name="netTcpBindingConfig_TimeRegistrationSystemService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
<binding name="netTcpBindingConfig_SystemService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
服务器的配置-服务:
<service name="MyCompany.Services.EasyLogicInterfaceService" behaviorConfiguration="release">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="netTcpBindingConfig_EasyLogicInterfaceService" contract="MyCompany.Services.IEasyLogicInterfaceService">
</endpoint>
<host>
<baseAddresses>
<add baseAddress="net.tcp://mysrv.myteam.local:54520/MyCompany.Services.EasyLogicInterfaceService.svc/" />
</baseAddresses>
</host>
</service>
<service name="MyCompany.Services.TimeRegistrationSystemService" behaviorConfiguration="release">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="netTcpBindingConfig_TimeRegistrationSystemService" contract="MyCompany.Services.ITimeRegistrationSystemService">
</endpoint>
<host>
<baseAddresses>
<add baseAddress="net.tcp://mysrv.myteam.local:54520/MyCompany.Services.SystemService.svc/" />
</baseAddresses>
</host>
</service>
<service name="MyCompany.Services.SystemService" behaviorConfiguration="release">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="netTcpBindingConfig_SystemService" contract="MyCompany.Services.ISystemService">
</endpoint>
<host>
<baseAddresses>
<add baseAddress="net.tcp://mysrv.myteam.local:54520/MyCompany.Services.SystemService.svc/" />
</baseAddresses>
</host>
</service>
以及行为:
<serviceBehaviors>
<behavior name = "debug">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name = "release">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
我起初以为这可能是一个打字错误,但我没有发现它(我是盲人吗?!?)。我已经在客户端解决方案中更新了我的服务引用,并随后发布了服务器代码和客户端代码。而且,我已经通过复制粘贴将服务器配置(绑定配置、端点添加等)中的所有相关字符串放入客户机配置中,以避免输入错误
然后我在stackoverflow上浏览了很多答案,却没有找到任何解决问题的方法
我可以在本地运行客户端和服务器代码,不会出现问题。这些问题只有在部署之后才会出现
通过system.diagnostics跟踪呼叫不会显示此错误消息以外的内容
你看到的比我多吗?或者你知道触发这个错误的任何问题吗?出现此错误时,客户端和服务器之间的连接已经成功建立,对吗?所以它不可能是Kerberos之类的问题
如果事实证明这只是一个打字错误,我会提前道歉。但我找不到任何
致以最良好的祝愿
<client>
<endpoint address="net.tcp://mysrv.myteam.local:54520/MyCompany.Services.TimeRegistrationSystemService.svc"... contract="SystemService.ISystemService" name="NetTcpBindingBinding_ISystemService" />
<endpoint address="net.tcp://mysrv.myteam.local:54520/MyCompany.Services.SystemService.svc"... contract="TimeRegistrationSystemService.ITimeRegistrationSystemService" name="NetTcpBindingBinding_ITimeRegistrationSystemService" />
</client>
客户端配置终结点具有反向协定
根据您的service.config,对于TimeRegistrationSystemService.svc,合同应该是itimerregistrationsystemservice,对于SystemService.svc,合同应该是Client.config中的issystemservice,在端点处,您能看到任何区别吗?该死!如果你需要的话,可以在头上打自己的表情符号在哪里。。。不用说,这就是我错过的错误。非常感谢!我完全错过了森林的树木。。。