调用操作:EndpointDispatcher 中的 ContractFilter 不匹配

Calling Action: ContractFilter mismatch at the EndpointDispatcher

我已经研究这个问题好几个小时了。我尝试获取 WCF 服务 运行ning,现在归结为 ContractFilter-Mismatch-Error wit 操作“http://tempuri.org/ISystemService/LogIn”。这是客户端配置的相关部分:

<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>

我一开始以为这可能是一个错字,但我没有找到它(我瞎了吗?!?)。我已经在客户端解决方案中更新了我的服务引用,然后发布了服务器代码和客户端代码。而且,我已经通过复制粘贴将服务器配置(绑定配置、端点地址等)中的所有相关字符串放入客户端配置中,以避免输入错误。

比我 运行 在 Whosebug 上找了很多答案都没有找到解决我的问题的方法。

我可以 运行 本地客户端和服务器代码没有问题。这些问题仅在部署后出现。

跟踪 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,合同应为 ITimeRegistrationSystemService,对于 SystemService.svc 合同应该是 ISystemService.