Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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>
like image 379
raychen3 Avatar asked Aug 12 '18 09:08

raychen3


People also ask

How do I enable TLS 1.2 for API call in asp net 2.0 application?

Create a new separate project in asp.net higher version. Add new Web Service or WebAPI(Later we will consume it in the main project). Write down a particular code here and call particular API which needs to validate with TLS 1.2. Now Deploy this web service/WebAPI and consume in the main project.

How do I enable TLS 1.2 in IIS?

Click the Windows button on the lower left-hand corner of your Desktop. Type "Internet Options" and select Internet Options from the list. Click on the Advanced tab and from there scroll down to the very bottom. Confirm that TLS 1.2 is checked.

What version of TLS does .NET 4.6 use?

By default, . NET Framework 4.7 and later versions is configured to use TLS 1.2 and allows connections using TLS 1.1 or TLS 1.0.


1 Answers

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

like image 154
raychen3 Avatar answered Sep 30 '22 14:09

raychen3