Asp.net mvc HTTPS合同不匹配问题WCF

Asp.net mvc HTTPS合同不匹配问题WCF,asp.net-mvc,wcf,security,iis,wcf-security,Asp.net Mvc,Wcf,Security,Iis,Wcf Security,我已在IIS中安装了自我https证书,并在本地计算机中将EchoService从http更改为https 但在选择了运输安全后,我的错误率就降低了 由于EndpointDispatcher上的ContractFilter不匹配,无法在接收器上处理具有操作“”的消息。这可能是因为合同不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无) 客户端应用程序配置: <?xml versi

我已在IIS中安装了自我https证书,并在本地计算机中将EchoService从http更改为https

但在选择了运输安全后,我的错误率就降低了

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

客户端应用程序配置:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
  </startup>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="EchoService">
          <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None" realm=""></transport>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://desktop-rfd4j23/WCFASPNETSecurityEx/EchoService.svc" binding="wsHttpBinding"
                bindingConfiguration="EchoService" contract="EchoService.IEchoService" name="EchoService">
      </endpoint>
    </client>
  </system.serviceModel>
</configuration>

调用client.Echo(“Hello WCF”)时出错;请帮我解决这个问题。谢谢。

我应该提到wsHttpBinding而不是webHttpBinding

<bindings>
      <wsHttpBinding>
        <binding name="wsHttp" hostNameComparisonMode="Exact">
          <security mode="Transport" >
            <transport clientCredentialType="None" proxyCredentialType="None" realm=""></transport>
            <message clientCredentialType="UserName"></message>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>

我应该提到wsHttpBinding而不是webHttpBinding

<bindings>
      <wsHttpBinding>
        <binding name="wsHttp" hostNameComparisonMode="Exact">
          <security mode="Transport" >
            <transport clientCredentialType="None" proxyCredentialType="None" realm=""></transport>
            <message clientCredentialType="UserName"></message>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>

您正在使用https锁定传输,并且需要用户名验证。 安全模式不应该设置为:

<security mode="TransportWithMessageCredential" >

你在你的客户身上处理过吗

<serviceCredentials>
    <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="xxx.MyUserNameValidator,xxx.WCF.Security"/>
</serviceCredentials>

您正在使用https锁定传输,并且需要用户名验证。 安全模式不应该设置为:

<security mode="TransportWithMessageCredential" >

你在你的客户身上处理过吗

<serviceCredentials>
    <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="xxx.MyUserNameValidator,xxx.WCF.Security"/>
</serviceCredentials>


您确定您正在使用https访问并且证书未颁发给localhost吗?您确定您正在使用https访问并且证书未颁发给localhost吗。