[英]WebRequest fails over TLS 1.2 for Windows Server 2008 R2
I know similar questions have been asked, but my problem seems to be different, as I have tried many of the solutions I have found on the web. 我知道有人问过类似的问题,但是我的问题似乎有所不同,因为我尝试了许多在网上找到的解决方案。 My problem is as following. 我的问题如下。
I'm running a .net 4.5.1 MVC application installed on IIS 7, which makes secure outbound requests to an external server supporting only TLS 1.2. 我正在运行IIS 7上安装的.net 4.5.1 MVC应用程序,该应用程序向仅支持TLS 1.2的外部服务器发出安全的出站请求。 All goes fine when i run the application from Windows 7 host, but on Windows Server 2008 R2 is fils with: 当我从Windows 7主机运行应用程序时一切正常,但是在Windows Server 2008 R2上,fils具有:
"The request was aborted: Could not create SSL/TLS secure channel." “请求已中止:无法创建SSL / TLS安全通道。”
In the beginning it was failing also on my local Windows 7, until I added this line before the WebRequest and worked: 在一开始,它在我的本地Windows 7上也失败了,直到我在WebRequest之前添加了以下行并开始工作:
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
But this didn't make it work on the server. 但这并不能使其在服务器上正常工作。
I also tried adding: 我也尝试添加:
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(AllwaysGoodCertificate);
ServicePointManager.Expect100Continue = true;
But didn't make any changes. 但是没有做任何改变。
I also tried on the server to add TLS 1.2 protocol to be accepted, as explained here https://support.quovadisglobal.com/KB/a433/how-to-enable-tls-12-on-windows-server-2008-r2.aspx 我还尝试在服务器上添加要接受的TLS 1.2协议,如此处所述https://support.quovadisglobal.com/KB/a433/how-to-enable-tls-12-on-windows-server-2008- r2.aspx
Restarted the machine, but still nothing new. 重新启动计算机,但仍然没有新内容。
Thank you very much in advance, I'm getting quite desperate with this issue :S 提前非常感谢您,我对这个问题非常绝望:S
I solved it changing this line 我解决了改变这条线
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
for this 为了这
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.