.Net Framework 4.6.1 not defaulting to TLS 1.2

后端 未结 11 2178
暖寄归人
暖寄归人 2020-11-30 23:45

Our client have recently upgrade the security protocol to TLS 1.2. Therefore We have our application upgraded to 4.6.1 expecting the security protocol will be default to TLS

11条回答
  •  难免孤独
    2020-12-01 00:14

    Based on the following link

    https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls

    I've added

    AppContext.SetSwitch("Switch.System.Net.DontEnableSystemDefaultTlsVersions", false);
    

    to my code, and this fixed the issue for me. This is meant to default to the highest level the OS supports, which is the same behaviour you get by default from 4.7 and above.

提交回复
热议问题