【问题标题】:Calling Action: ContractFilter mismatch at the EndpointDispatcher调用操作:EndpointDispatcher 的 ContractFilter 不匹配
【发布时间】:2018-07-05 23:12:54
【问题描述】:

我正在研究这个问题几个小时。我尝试让 WCF 服务运行,现在它归结为带有操作“http://tempuri.org/ISystemService/LogIn”的 ContractFilter-Mismatch-Error。这是客户端配置的相关部分:

<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.config中,在endpoint你能看出有什么不同吗?

标签: wcf web-config net.tcp


【解决方案1】:
<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

【讨论】:

  • 该死!如果你需要它,它在哪里敲打自己的表情符号......不用说,那是我错过的错误。非常感谢!我完全错过了树木的森林......
猜你喜欢
  • 2013-02-21
  • 1970-01-01
  • 2014-04-16
  • 2013-03-09
  • 2011-07-26
  • 1970-01-01
  • 2011-03-28
  • 2019-07-20
  • 1970-01-01
相关资源
最近更新 更多