WCF - 客户端是否必须具有与端点相同的行为?
我有以下 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
异常会准确地告诉您出了什么问题。您是否在请求双方使用相同的合同?绑定和安全性是否相同?
如果您可以首先响应这些查询,我们应该能够看到请求失败的原因。您还应该在服务上启用跟踪并查看发出的错误/警告级别跟踪。这也应该可以帮助您诊断问题。
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.