gpt4 book ai didi

.net - 防止错误无法在某些服务器上创建 SSL/TLS 安全通道

转载 作者:太空宇宙 更新时间:2023-11-03 13:19:50 25 4
gpt4 key购买 nike

我知道有很多人提到了这个错误,但尽管查看并尝试了许多建议的解决方案,但我仍在努力解决这个问题。

错误只发生在某些机器上。它不会发生在我的开发机器上,也不会发生在许多其他机器上,但我们能够在 Windows 2008 RS 服务器以及 Windows 2012R2 以及可能的其他服务器上重复此操作。

我能够在受影响机器上的浏览器中访问该页面,因此这将排除缺少密码(或者有人告诉我)。

每次我运行我的简单代码时,我都会在某些机器上遇到同样的错误:

The request was aborted: Could not create SSL/TLS secure channel.

我的简单代码是这样的:

 Private Async Function CallRest() As Task

Using http As HttpClient = New HttpClient()
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

Dim url As String = "https://www.zeidman.info/appreg/resttest.php"

Dim result = Await http.GetAsync(url)

Dim content = Await result.Content.ReadAsStringAsync

Console.WriteLine(content)
End Using


End Function

我试过添加:

ServicePointManager.Expect100Continue = True

出于测试目的,我尝试添加:

ServicePointManager.ServerCertificateValidationCallback = AddressOf AcceptAllCertifications

具有相应的功能

Public Function AcceptAllCertifications(sender As Object,
certification As System.Security.Cryptography.X509Certificates.X509Certificate,
chain As System.Security.Cryptography.X509Certificates.X509Chain,
sslPolicyErrors As Security.SslPolicyErrors) As Boolean


Return True
End Function

我也看到了这个answer并使用了那个版本的 ServerCertificateValidationCallback 但代码甚至没有进入那个方法(我把日志记录在里面)

在此question中发表评论建议使用 system.net 跟踪,尽管按照说明进行操作,但我无法让它显示任何输出。

我们非常欢迎任何建议。

最佳答案

我让这个工作。谢谢吉米的所有建议。很有帮助。

正是你的第 5 点让我重新思考。我从 SSL Labs 运行分析在我尝试连接的服务器上,发现只有四个密码可用。在我的 Win2008R2 客户端上,我使用了 IISCrtypto查看安装了哪些密码。我看到服务器上没有匹配项。我添加了丢失的密码,重新启动,然后我能够访问该站点。

我看到的一件事是,之前 Internet Explorer 无法访问该站点,但之后它可以访问,所以它显然使用了内置的 Windows 密码。

关于.net - 防止错误无法在某些服务器上创建 SSL/TLS 安全通道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58978230/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com