我正在嘗試將一組項目更新到.NET 4.6.1以獲得TLS 1.2支持。該解決方案包含類庫,控制檯應用程序,WebForms網站和MVC網站的組合。爲什麼ServicePointManager.SecurityProtocol在同一臺機器上的控制檯應用程序和IIS網站上有所不同?
我已經改變了每個項目和網站的目標.NET 4.6.1,並重新編譯了一切。
現在,如果我在控制檯應用程序之一檢查ServicePointManager.SecurityProtocol的默認值,然後我得到如下:
Tls, Tls11, Tls12
但是如果我檢查ServicePointManager.SecurityProtocol默認值之一IIS下運行的WebForms網站,然後我得到如下:
Ssl3, Tls
所以我II對比下控制檯應用程序和Web窗體網站時,在同一臺機器上看到不同的值ServicePointManager.SecurityProtocol S.
我可以確認的WebForms網站已在Web.config中「的System.Web」下以下幾點:
<compilation debug="true" targetFramework="4.6.1">
但它看起來好像IIS是忽略了「targetFramework」屬性。
有沒有什麼,我需要在IIS中做到這一點按預期工作?
UPDATE:
看來,IIS實際上是紀念「targetFramework」屬性,但相比一個控制檯應用程序時ServicePointManager.SecurityProtocol仍然返回IIS下不同的默認值。