我正在尝试将一组项目更新到.NET 4.6.1,以获得TLS 1.2支持。该解决方案包含类库,控制台应用程序,WebForms网站和MVC网站的混合。
我已经将每个项目和网站都更改为以.NET 4.6.1为目标,并重新编译了所有内容。
现在,如果我在其中一个控制台应用程序中检查ServicePointManager.SecurityProtocol的默认值,则会得到以下信息:
Tls, Tls11, Tls12
Run Code Online (Sandbox Code Playgroud)
但是,如果我在IIS下运行的一个WebForms网站中检查ServicePointManager.SecurityProtocol的默认值,则会得到以下信息:
Ssl3, Tls
Run Code Online (Sandbox Code Playgroud)
因此,在比较控制台应用程序和IIS下的WebForms网站时,我可以在同一台计算机上看到ServicePointManager.SecurityProtocol的不同值。
我可以确认WebForms网站在“ system.web”下的Web.config中具有以下内容:
<compilation debug="true" targetFramework="4.6.1">
Run Code Online (Sandbox Code Playgroud)
但是,似乎IIS忽略了“ targetFramework”属性。
我需要在IIS中做些什么才能使其按预期工作?
更新:
看来IIS实际上是在使用“ targetFramework”属性,但是与控制台应用程序相比,ServicePointManager.SecurityProtocol在IIS下仍返回不同的默认值。