简体   繁体   English

WCF-客户端是否必须具有与端点相同的行为?

[英]WCF - Does a client must have the same behavior as the endpoint?

I have the following WCF endpoint configuration: 我有以下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>

Here is my client configuration: 这是我的客户端配置:

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

I am doing a web service call dynamically, providing a different address : 我正在动态地进行网络服务调用,提供了一个不同的地址:

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

When I call the endpoint, I get the following error message: 呼叫端点时,出现以下错误消息:

{"The message with Action 'http://IMyService/CreateContainer' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, eg Message, Transport, None)."} {由于EndpointDispatcher的ContractFilter不匹配,带有接收方'http:// IMyService / CreateContainer'的消息无法在接收方处理。这可能是由于合同不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。请检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息,传输,无)。“}

Could this be due to the fact that my client does NOT have the same serviceBehavior as the endpoint? 这可能是由于我的客户端与端点不具有相同的serviceBehavior吗? Is there something else I can be missing? 还有其他我想念的东西吗?

Thanks! 谢谢!

The exception tells you exactly what is wrong. 异常会告诉您确切的错误。 Are you using the same contract on both sides of the request? 您在请求的双方使用相同的合同吗? Are the bindings and security the same? 绑定和安全性是否相同?

If you can respond to those queries first, we should be able to see what the request is failing. 如果您可以首先响应这些查询,那么我们应该能够看到请求失败的原因。 You should also enable tracing on the service and see what error/warning level traces are emitted. 您还应该在服务上启用跟踪,并查看发出了哪些错误/警告级别跟踪。 That should also help you diagnose the issue. 那也应该可以帮助您诊断问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM