且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

.NET 4.5和.NET 4.5.1默认情况下是否启用TLS 1.1和TLS 1.2?

更新时间:2023-02-11 16:58:45

否。为各种框架版本启用的默认协议为:

No. The default protocols enabled for the various framework versions are:


  • .NET Framework 4.5和4.5.1:SSLv3和TLSv1

  • .NET Framework 4.5.2:SSLv3,TLSv1和TLSv1.1

  • .NET Framework 4.6及更高版本:TLSv1,TLSv1.1和TLS1.2

来源: [1] [2]

您可以使用 ServicePointManager 类指定应用程序支持的协议,特别是通过设置 SecurityProtocol 属性,在您的情况下,您需要将其设置为以下内容:

You can specify which protocols your application supports by using the ServicePointManager class, specifically by setting the SecurityProtocol property, which in your case you would want to set to the following:

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