根据 .net 的指导TLS协议编程,当您的项目面向 .net 4.6 时,它建议通过 appcontext 开关配置安全性。当在控制台应用程序的 app.config 中添加 appcontext 时,这种方法有效。但是,在网站项目的 web.config 中添加 appconext 开关时,它不起作用。
这是我添加的配置。
<runtime>
<AppContextSwitchOverrides value="Switch.System.Net.DontEnableSchUseStrongCrypto=false;Switch.System.Net.DontEnableSystemDefaultTlsVersions=false"/>
</runtime>
AppContext 在 Web 配置文件中切换用法:
<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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)