2015-07-10 68 views
0

我知道類似的問題已經被問到,但我的問題似乎有所不同,因爲我已經嘗試了許多我在網上找到的解決方案。我的問題如下。WebRequest在Windows Server 2008 R2的TLS 1.2上失敗

我正在運行安裝在IIS 7上的.net 4.5.1 MVC應用程序,該應用程序向僅支持TLS 1.2的外部服務器提供安全的出站請求。一切順利,當我從Windows 7主機運行應用程序時,但在Windows Server 2008 R2上是fils:

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

在它也沒有在我的本地Windows 7開始,直到我將向WebRequest前加入這一行,並努力:

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

但這並沒有使它的服務器上運行。

我也嘗試添加:

ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(AllwaysGoodCertificate); 
ServicePointManager.Expect100Continue = true; 

但沒做任何改變。

我也試過在服務器上添加TLS 1.2協議被接受,因爲這裏解釋https://support.quovadisglobal.com/KB/a433/how-to-enable-tls-12-on-windows-server-2008-r2.aspx

機器重​​新啓動,但仍沒有新的。

非常感謝你提前,我十分絕望的這個問題:■

回答

0

我解決它改變這一行

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; 

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; 
相關問題