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

发布于 2024-10-28 07:41:22 字数 1486 浏览 1 评论 0原文

我有以下 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>

我正在动态执行 Web 服务调用,提供不同的地址:

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

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

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

这是否是由于我的客户端不具有与端点相同的 serviceBehavior 所致?还有什么我可以错过的吗

I have the following WCF endpoint configuration:

      <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, e.g. Message, Transport, None)."}

Could this be due to the fact that my client does NOT have the same serviceBehavior as the endpoint? Is there something else I can be missing?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

油焖大侠 2024-11-04 07:41:22

异常会准确地告诉您出了什么问题。您是否在请求双方使用相同的合同?绑定和安全性是否相同?

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文