基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系
2012-08-14 17:47
633 查看
基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系
问题分析:
Could not establish trust relationship for the SSL/TLS secure channel with authority 'computer:9001'.
不能和授权计算机为 SSL/TLS 安全通道建立信任关系.
实际原因和证书有很大关系,这里证书是跟证书颁发机构信任的证书,在客户端和服务端建立安全会话的时候,无法信任此证书。
另外一个可能的原因是你其他域里也使用此一个证,这个也有可能导致错误。
解决办法:
定义一个类,来对远程X.509证书的验证,进行处理,返回为true.我们要自己定义一个类,然后在客户单调用WCF服务之前,执行一次即可。代码如下:
你要在调用操作点先调用这个方法: Util.SetCertificatePolicy();
问题分析:
Could not establish trust relationship for the SSL/TLS secure channel with authority 'computer:9001'.
不能和授权计算机为 SSL/TLS 安全通道建立信任关系.
实际原因和证书有很大关系,这里证书是跟证书颁发机构信任的证书,在客户端和服务端建立安全会话的时候,无法信任此证书。
另外一个可能的原因是你其他域里也使用此一个证,这个也有可能导致错误。
解决办法:
定义一个类,来对远程X.509证书的验证,进行处理,返回为true.我们要自己定义一个类,然后在客户单调用WCF服务之前,执行一次即可。代码如下:
public static class Util { /// <summary> /// Sets the cert policy. /// </summary> public static void SetCertificatePolicy() { ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidate; } /// <summary> /// Remotes the certificate validate. /// </summary> private static bool RemoteCertificateValidate( object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error) { // trust any certificate!!! System.Console.WriteLine("Warning, trust any certificate"); return true; } }
你要在调用操作点先调用这个方法: Util.SetCertificatePolicy();
相关文章推荐
- Nuget--基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系
- 基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系。
- 调用Https WebService是报“基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系”的解决过程
- C#模拟Http请求时出现 基础连接已经关闭 未能为 SSLTLS 安全通道建立信任关系
- C# 基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系。
- 问题:基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系
- 解决Error"基础连接已经关闭: 未能为SSL/TLS 安全通道建立信任关系
- 基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系
- 解决12306.cn网站验证码获取提示“基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系“的问题
- c# 基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系(转)
- 转转:解决Error"基础连接已经关闭: 未能为SSL/TLS 安全通道建立信任关系。"
- 用httpWebRequest调用https开头的php webservice,报“基础连接已经关闭: 未能为SSL/TLS 安全通道建立信任关系”错误的解决方法
- 解决Error"基础连接已经关闭: 未能为SSL/TLS 安全通道建立信任关系。"
- 基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系
- 解决12306.cn网站验证码获取提示“基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系“的问题
- 使用SVCUTIL生成客户端代理类时:元数据包含无法解析的引用:“https: 无法为 SSL/TLS 安全通道与颁发机构“localhost”建立信任关系。基础连接已经关闭: 未能为 SSL/TL
- 基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系。
- C#模拟Http请求时出现 基础连接已经关闭 未能为 SSLTLS 安全通道建立信任关系
- "基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系"证书验证失败的解决过程(3)
- 基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系。