问题描述
我有一台运行十几个.NET Framework 4.0 WebForms应用程序的Windows Server 2008 R2服务器,我需要禁用TLS 1.0和更低版本。这样做时,所有安全连接都会失败,因此我不得不重新启用TLS 1.0。有什么方法可以在Framework 4.0环境中使用TLS 1.2?
I have a Windows server 2008 R2 server running a dozen .NET Framework 4.0 WebForms applications, and I need to disable TLS 1.0 and lower. When I do that, all secure connections fail and I was forced to re-enable TLS 1.0. Is there any way to use TLS 1.2 in a framework 4.0 environment? Perhaps I am missing something?
此外,由于我们使用的CMS版本的限制,我们目前无法升级框架。
Also, due to limitations of the version CMS we are using, we cannot upgrade the Framework at this time.
推荐答案
我发现唯一更改此方法的方法是直接在代码上:
The only way I have found to change this is directly on the code :
在您的应用程序开始时设置
at the very beginning of your app you set
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
您应包括 system.net
类
我在调用Web服务之前是这样做的,因为我们也必须阻止tls1。
I did this before calling a web service because we had to block tls1 too.
这篇关于.NET Framework 4.0中的TLS 1.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!