Windows Server 2008 R2 的 WebRequest 故障转移 TLS 1.2
WebRequest fails over TLS 1.2 for Windows Server 2008 R2
我知道有人问过类似的问题,但我的问题似乎有所不同,因为我尝试了很多在网上找到的解决方案。我的问题如下。
我正在 运行安装在 IIS 7 上的 .net 4.5.1 MVC 应用程序,它向仅支持 TLS 1.2 的外部服务器发出安全出站请求。当我 运行 来自 Windows 7 主机的应用程序时一切正常,但在 Windows Server 2008 R2 上包含:
"The request was aborted: Could not create SSL/TLS secure channel."
一开始它在我的本地 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
重启机器,还是没有新的东西
非常感谢你,我对这个问题感到非常绝望:S
我改了这条线就解决了
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
为此
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
我知道有人问过类似的问题,但我的问题似乎有所不同,因为我尝试了很多在网上找到的解决方案。我的问题如下。
我正在 运行安装在 IIS 7 上的 .net 4.5.1 MVC 应用程序,它向仅支持 TLS 1.2 的外部服务器发出安全出站请求。当我 运行 来自 Windows 7 主机的应用程序时一切正常,但在 Windows Server 2008 R2 上包含:
"The request was aborted: Could not create SSL/TLS secure channel."
一开始它在我的本地 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
重启机器,还是没有新的东西
非常感谢你,我对这个问题感到非常绝望:S
我改了这条线就解决了
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
为此
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;