Cannot set app to use system default TLS version by adding appcontext settings in web.config
Asked Answered
J

1

10

According to .net guidance of TLS protocol programming, it suggests to config security via appcontext switch when your project targets on .net 4.6. This way works when add appcontext in app.config for console application. However, it doesn't work when add appconext switch in web.config for website project.

This is the config I add.

<runtime>
   <AppContextSwitchOverrides value="Switch.System.Net.DontEnableSchUseStrongCrypto=false;Switch.System.Net.DontEnableSystemDefaultTlsVersions=false"/>
</runtime>
Jalousie answered 12/8, 2018 at 9:2 Comment(0)
J
24

AppContext switches usage in web config file:

<appSettings>
    <add key="AppContext.SetSwitch:Switch.System.Net.DontEnableSchUseStrongCrypto" value="false" />
    <add key="AppContext.SetSwitch:Switch.System.Net.DontEnableSystemDefaultTlsVersions" value="false" />
</appSettings>

https://github.com/dotnet/docs/issues/6675

Jalousie answered 20/8, 2018 at 1:44 Comment(1)
while this works, setting <httpRuntime targetFramework="4.7.2" /> may also work. https://mcmap.net/q/668551/-tls-1-2-not-negotiated-in-net-4-7-without-explicit-servicepointmanager-securityprotocol-callSubmerge

© 2022 - 2024 — McMap. All rights reserved.