Hoc*_*Lim 4 .net c# ssl tls1.2
我正在尝试将以下代码行添加到网站项目中的Global.asax文件中.
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
Run Code Online (Sandbox Code Playgroud)
vs2012 IntelliSense显示存在Tls12定义.但构建是说定义不存在(参见屏幕截图).
我已经尝试将System.Net.dll添加到项目的bin文件夹中,但构建仍然失败.知道我怎么能解决这个问题?
fig*_*olu 24
仅在Framework 4.0上缺少SecurityProtocolType.Tls11和SecurityProtocolType.Tls12枚举值.
SecurityProtocolType数值:
SystemDefault(0)
Ssl3(48 - 0x30)
Tls(192 - 0xC0)
Tls11(768 - 0x300)在Framework 4.0
Tls12(3072 - 0xC00)上缺少Framework 4.0
在Framework 4.0上,如果要允许TLS 1.0,1.1和1.2,只需替换:
SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12
Run Code Online (Sandbox Code Playgroud)
通过:
(SecurityProtocolType)(0xc0 | 0x300 | 0xc00)
Run Code Online (Sandbox Code Playgroud)
TLS 以及如何避免连接错误。
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Run Code Online (Sandbox Code Playgroud)
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
Run Code Online (Sandbox Code Playgroud)
就我个人而言,在我的.Net 4.0框架上使用了一些asp经典文件:
ServicePointManager.SecurityProtocol = (SecurityProtocolType)(0xc0 | 0x300 | 0xc00);
Run Code Online (Sandbox Code Playgroud)
https://blogs.perficient.com/2016/04/28/tsl-1-2-and-net-support/
| 归档时间: |
|
| 查看次数: |
29031 次 |
| 最近记录: |