让.NET 4.0支持TLS1.2协议

The DEFAULT System.Net.ServicePointManager.SecurityProtocol in both .NET 4.0/4.5 is:

 SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls.

.NET 4.0 supports up to TLS 1.0 while .NET 4.5 supports up to TLS 1.2

However, an application targeting .NET 4.0 can still support up to TLS 1.2 if .NET 4.5 is installed in the same environment. .NET 4.5 installs on top of .NET 4.0, replacing System.dll.

I've verified this by observing the correct security protocol set in traffic with fiddler4 and by manually setting the enumerated values in a .NET 4.0 project:

ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 |(SecurityProtocolType)768 | (SecurityProtocolType)3072;

 

 

posted @ 2016-09-02 17:00  FrankYou  阅读(4482)  评论(1编辑  收藏  举报