【问题标题】:WCF: Could not establish trust relationship for the SSL/TLS secure channel with authority 'dev.xxxxx.com'WCF:无法为具有权限“dev.xxxxx.com”的 SSL/TLS 安全通道建立信任关系
【发布时间】:2018-11-10 20:47:40
【问题描述】:

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

我不断收到此错误消息。 " 无法为具有权限 '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>

【问题讨论】:

  • 请显示端点的服务器配置
  • 这就是我在 hte 配置文件中的全部内容。

标签: wcf ssl wcf-binding wcf-security


【解决方案1】:

我不确定服务的配置应该是什么样子,但如果我比较这 2 个配置。 我在 client.config 中看到 SecurityMode 'transport',但在服务中看不到任何安全模式。 默认安全模式为“无”,因此可能不匹配。

【讨论】:

    【解决方案2】:

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

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

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

    证书错误示例:

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

    更多信息在这里:

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

    【讨论】:

      猜你喜欢
      • 2023-03-15
      • 1970-01-01
      • 2010-12-17
      • 2014-08-07
      • 2015-02-12
      • 1970-01-01
      • 2013-03-22
      • 1970-01-01
      相关资源
      最近更新 更多