我遇到了这个例外:
操作“http://tempuri.org/IUserService/HelloWorld”的邮件不能是> >由于EndpointDispatcher上的ContractFilter不匹配而在接收方处理。这可能是由于合同不匹配(发送方与接收方之间的操作不匹配)或发送方与接收方之间的绑定/安全性不匹配。检查发件人和收件人是否具有相同的合同和相同的约束(包括安全要求,例如邮件,传输,无)。
Web.Config如下
服务器
<system.serviceModel>
<services>
<service behaviorConfiguration="ServiceBehaviour" name="API.UserService">
<endpoint
name ="basic"
address=""
binding="basicHttpBinding"
bindingConfiguration ="basicBinding"
contract="API.IUserService" />
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="basicBinding"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None"></security>
<readerQuotas maxStringContentLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
客户端
<client>
<endpoint
name ="basic"
address="http://localhost:8080/UserService.svc"
binding="basicHttpBinding"
bindingConfiguration ="basicBinding"
contract="API.IUserService" />
</client>
</system.serviceModel>