【问题标题】:WCF - Does a client must have the same behavior as the endpoint?WCF - 客户端是否必须具有与端点相同的行为?
【发布时间】:2011-07-26 06:14:18
【问题描述】:

我有以下 WCF 端点配置:

      <service behaviorConfiguration="MyNamespace.ContainerManagementServiceBehavior"
    name="MyNamespace.ContainerManagementService">
    <endpoint address="" binding="basicHttpBinding"
       name="ContainerManagementbasicHttpEndpoint" contract="MyNamespace.IContainer"/>                  
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>      
   <behaviors>      
    <behavior name="MyNamespace.ContainerManagementServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
</behaviors>

这是我的客户端配置:

<client>
  <endpoint address="http://localhost:3227/Services/ContainerManagementService.svc"
    binding="basicHttpBinding" 
    contract="MyNamespace2.IAQSIDMService" name="externalService" />
</client>

我正在动态进行网络服务调用,提供不同的地址:

var svc = new AQSIDMServiceClient(Constants.External_Service_ConfigurationName, serviceAddress);

当我调用端点时,我收到以下错误消息:

{“由于 EndpointDispatcher 的 ContractFilter 不匹配,接收方无法处理带有 Action 'http://IMyService/CreateContainer' 的消息。 这可能是因为合约不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无)。"}

这可能是因为我的客户端没有与端点相同的 serviceBehavior 吗?还有什么我可以错过的吗?

谢谢!

【问题讨论】:

    标签: wcf wcfserviceclient wcf-behaviour


    【解决方案1】:

    异常告诉你究竟哪里出了问题。您是否在请求的双方都使用相同的合同?绑定和安全性是否相同?

    如果您可以先响应这些查询,我们应该能够看到请求失败的原因。您还应该在服务上启用跟踪并查看发出了哪些错误/警告级别的跟踪。这也应该有助于您诊断问题。

    【讨论】:

      猜你喜欢
      • 2015-05-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-26
      • 1970-01-01
      • 2021-04-09
      • 1970-01-01
      相关资源
      最近更新 更多