WCF:无法与权限'dev.xxxxx.com'

时间:2018-05-31 18:59:01

标签: wcf ssl wcf-binding wcf-security

我有一个WCF Web服务应用程序。构建另一个.net应用程序来使用wcf webservice。

我一直收到此错误消息。 “无法与权限'dev.xxxxx.com'建立SSL / TLS安全通道的信任关系。”

我用谷歌搜索并尝试了一些不同的解决方案,仍然无法解决问题。

WCF服务配置:

  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <bindings>
      <basicHttpBinding>
        <binding maxBufferSize="104857600" maxReceivedMessageSize="104857600"  sendTimeout="00:10:00">
        </binding>
      </basicHttpBinding>
    </bindings>

  </system.serviceModel>
  <system.webServer>

客户端配置:

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpsBinding_IIRSvc">
          <security mode="Transport">
            <transport clientCredentialType="None"
                proxyCredentialType="None"
                realm="" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://dev.xxxxx.com/IRSvc.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpsBinding_IIRSvc"
        contract="irsvc.IIRSvc" name="BasicHttpsBinding_IIRSvc" />
    </client>
  </system.serviceModel>

2 个答案:

答案 0 :(得分:1)

我不确定服务的配置应该是什么样的,但如果我比较2个配置。 我看到一个SecurityMode&#39; transport&#39;在client.config中,但我没有在服务中看到任何安全模式。 默认安全模式为“无”。也许那可能不匹配。

答案 1 :(得分:0)

也可能是您的证书 CA 根证书不在 Trusted Root Certification Authorities 中。开始 mmc.exe 然后转到:

文件 -> 添加或删除管理单元 -> 证书 -> 添加 -> 计算机帐户 -> 本地计算机。点击完成。

检查您的 HTTPS CA 根证书证书是否存在于 Trusted Root Certification Authorities 中,否则将其复制到那里。

证书错误示例:

<块引用>

此 CA 根证书不受信任,因为它不在 受信任的根证书颁发机构存储。

更多信息在这里:

https://stackoverflow.com/a/48790088/3850405

相关问题