簡體   English   中英

防止錯誤無法在某些服務器上創建 SSL/TLS 安全通道

[英]Prevent error could not create SSL/TLS secure channel on some servers

我知道有很多關於此錯誤的引用,但盡管查看並嘗試了許多建議的解決方案,但我仍在努力解決該問題。

該錯誤僅發生在某些機器上。 它不會發生在我的開發機器上,也不會發生在許多其他機器上,但我們可以在 Windows 2008 RS 服務器以及 Windows 2012R2 以及可能的其他服務器上重復此操作。

我能夠在受影響機器上的瀏覽器中訪問該頁面,因此這將排除缺少密碼(或者我被告知)。

每次我運行我的簡單代碼時,我都會在某些機器上遇到相同的錯誤:

請求被中止:無法創建 SSL/TLS 安全通道。

我的簡單代碼是這樣的:

 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

與對應的function

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

我也看到了這個答案並使用了該版本的 ServerCertificateValidationCallback 但代碼甚至沒有 go 進入該方法(我將日志記錄在其中)

問題中的一條評論建議使用 system.net 跟蹤,盡管按照說明進行操作,但我無法讓它顯示任何 output。

任何建議都會非常受歡迎。

我得到了這個工作。 感謝 Jimi 的所有建議。 非常有幫助。

正是你的第 5 點讓我再次思考。 我在嘗試連接的服務器上運行SSL Labs的分析,發現只有四個密碼可用。 在我的 Win2008R2 客戶端上,我使用IISCrtypto查看安裝了哪些密碼。 我看到服務器上沒有匹配項。 我添加了丟失的密碼,重新啟動並能夠訪問該站點。

我看到的一件事是,在 Internet Explorer 無法訪問該站點之前,但之后它可以很明顯地使用內置的 Windows 密碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM