简体   繁体   English

错误:无法创建SSL / TLS安全通道Windows 8

[英]Error: Could not create SSL/TLS secure channel Windows 8

After upgrading to Windows 8, I am having problems with a web service call that was previously working. 升级到Windows 8后,以前无法正常使用的Web服务调用出现问题。 I've already verified on two Windows 8.1 machines and one Windows 8 machine that the following code fails, but it works without error on Windows 7 and Windows Server 2008 R2. 我已经在两台Windows 8.1机器和一台Windows 8机器上验证以下代码失败,但是在Windows 7和Windows Server 2008 R2上它可以正常工作。

var uriString = "https://secure.unitedmileageplus.com/";

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uriString);

try {
    using(WebResponse response = request.GetResponse()) {
        response.Dump();
    }
}
catch(Exception e) {
    e.Dump();
}

WebException The request was aborted: Could not create SSL/TLS secure channel. WebException请求已中止:无法创建SSL / TLS安全通道。

It seems to be localized to this endpoint, as I am able to successfully make SSL calls to other URLS. 它似乎已本地化到此端点,因为我能够成功地对其他URL进行SSL调用。 I've done some Wireshark sniffing already, but not knowing what to look for, it wasn't much help. 我已经做了一些Wireshark嗅探,但是不知道要寻找什么,它并没有太大帮助。 Let me know if you'd like me to provide those logs as well. 让我知道您是否也希望提供这些日志。

WebRequest set TLS/SSL version to TLS 1.0 by default. WebRequest默认将TLS / SSL版本设置为TLS 1.0。 You can set it back to SSL 3.0 using ServicePointManager.SecurityProtocol . 您可以使用ServicePointManager.SecurityProtocol将其设置回SSL 3.0。 Eg: 例如:

static void Main(string[] args)
{
    var uriString = "https://secure.unitedmileageplus.com/";

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uriString);

    ServicePointManager.ServerCertificateValidationCallback =
        new RemoteCertificateValidationCallback(AcceptAllCertifications);

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;

    try
    {
        using (WebResponse response = request.GetResponse())
        {
            Debug.WriteLine(response);
        }
    }
    catch (Exception e)
    {
        Debug.WriteLine(e);
    }
}

public static bool AcceptAllCertifications(
    object sender,
    System.Security.Cryptography.X509Certificates.X509Certificate certification,
    System.Security.Cryptography.X509Certificates.X509Chain chain,
    SslPolicyErrors sslPolicyErrors)
{
    return true;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 防止错误无法在某些服务器上创建 SSL/TLS 安全通道 - Prevent error could not create SSL/TLS secure channel on some servers SChannel 错误:请求被中止:无法创建 SSL/TLS 安全通道 - SChannel error: The request was aborted: Could not create SSL/TLS secure channel BufferNotEnough无法创建SSL / TLS安全通道 - BufferNotEnough Could not create SSL/TLS secure channel 无法使用HttpRequest创建SSL / TLS安全通道 - Could not create SSL/TLS secure channel with HttpRequest .Net无法创建SSL / TLS安全通道 - .Net could not create SSL/TLS secure channel HTTPWebRequest无法创建SSL / TLS安全通道 - HTTPWebRequest Could not create SSL/TLS secure channel Windows Server 2016 Standard 上的“无法创建 SSL/TLS 安全通道”——可能是 TLS 1.3 问题? - "Could not create SSL/TLS secure channel" on Windows Server 2016 Standard -- possible TLS 1.3 issue? VS 2013/Windows 10:添加/更新服务参考获取消息无法创建 SSL/TLS 安全通道 - VS 2013/Windows 10: Adding/Updating Service Reference getting message Could not create SSL/TLS secure channel 请求已中止:无法创建SSL / TLS安全通道 - SecurityProtocol行为 - The request was aborted: Could not create SSL/TLS secure channel - SecurityProtocol behavior 无法创建 SSL/TLS 安全通道。 安全通道故障 - Could not create SSL/TLS secure channel. SecureChannelFailure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM