【问题标题】:Exceprion - System.ServiceModel.Security.SecurityNegotiationException: „Could not establish trust relationship for the SSL/TLS secure channel异常 - System.ServiceModel.Security.SecurityNegotiationException:“无法为 SSL/TLS 安全通道建立信任关系
【发布时间】:2021-12-06 02:04:33
【问题描述】:

我在 VisualStudio 中制作肥皂客户端。我尝试使用 X509Certificate 发送任何请求。 我得到了错误:

System.ArgumentException: „提供的 URI 方案“http”无效;预期的“https”。参数名称:via”

我的自定义绑定代码如下所示:

<customBinding>
        <binding name="myCustomBindingConfig">
                <security authenticationMode="CertificateOverTransport"
                          defaultAlgorithmSuite="Basic256"
                          requireDerivedKeys="true"
messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
                    </security>
                    <textMessageEncoding messageVersion="Soap11"></textMessageEncoding>
                    <httpsTransport maxReceivedMessageSize="2000000000" />
                </binding>
            </customBinding>

于是我把http改成https,却又出现了一个错误:

System.ServiceModel.Security.SecurityNegotiationException:“无法为 SSL/TLS 安全通道与权限 'services.pl' 建立信任关系。”

这是测试环境,服务使用自签名证书。

我已经尝试添加:

     ServicePointManager.Expect100Continue = true;
     ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
     ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(AlwaysGoodCertificate);

在我的代码顶部,正如提到的here,但没有发生任何事情(我仍然有错误)。 我现在能做什么?

【问题讨论】:

    标签: c# ssl x509certificate wcf-binding wcf-security


    【解决方案1】:

    请检查以下几点来解决问题:

    1. 您是否使用了证书中的正确名称?

    2. 您是否拥有服务器的 DNS 和视线?

    3. 新服务器机器的时钟设置正确吗?

    4. 如果你从服务器浏览到soap服务,你能得到SSL吗?

    5. 证书是否安装在正确的位置,证书信任链问题是否有问题。

    6. 服务器的机器级代理设置正确吗?

    【讨论】:

      猜你喜欢
      • 2013-03-22
      • 2014-07-17
      • 2011-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-22
      • 2016-08-30
      • 1970-01-01
      相关资源
      最近更新 更多