【发布时间】:2015-10-24 03:00:42
【问题描述】:
考虑一下:
[ServiceContract]
public interface ICreditCardExtractor
{
[OperationContract]
[WebGet]
string CoolAction();
}
我已将 IIS 中的新应用程序定向到工件,并且能够浏览文件。
但是,当我尝试调用 CoolAction 时(通过浏览到 http://localhost/MySvc/CreditCardExtractor.svc/CoolAction)
我明白了
由于 EndpointDispatcher 的 ContractFilter 不匹配,接收方无法处理带有 Action '' 的消息。这可能是因为合约不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无)。
这是我的web.config:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
<!--pages controlRenderingCompatibilityVersion="4.0"/-->
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<!--added service behaviour configuration-->
<services>
<service name="WcfService1.CreditCardExtractor">
<endpoint
address=""
binding="webHttpBinding"
contract="WcfService1.ICreditCardExtractor" />
</service>
</services>
<serviceHostingEnvironment
aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
....
</configuration>
【问题讨论】: