【发布时间】:2012-09-21 13:55:02
【问题描述】:
我正在努力解决 WCF 服务配置的问题。 我有以下配置:
<behaviors>
<serviceBehaviors>
<behavior name="SampleWebBehavior">
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<behavior name="MyServiceTypeBehaviors">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false"/>
它运行良好,我可以尝试使用 WcfTestClient.exe 的方法并获得正确的响应。但我需要绑定是 webHttpBinding,这样我才能在浏览器中看到结果并创建 JSON 请求和响应。 但是当我将绑定更改为 webHttpBinding 时,它会抛出一个错误:
由于 EndpointDispatcher 的 ContractFilter 不匹配,接收方无法处理带有 Action '' 的消息。这可能是因为合约不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无)。
感谢您的帮助。
【问题讨论】:
-
我已经尝试将 [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)] 添加到类