TLS 1.2 not negotiated in .NET 4.7 without explicit ServicePointManager.SecurityProtocol call

后端 未结 5 1518
长情又很酷
长情又很酷 2020-12-04 15:51

I need to upgrade a .NET application to support a call to an API on a website that only supports TLS 1.2. From what I read, if the application is targeting 4.6 or higher the

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-04 16:05

    I am on Windows 7 and .NET 4.7.1

    The recommendation to use Switch.System.ServiceModel.DisableUsingServicePointManagerSecurityProtocols and Switch.System.Net.DontEnableSchUseStrongCrypto mentioned in two other answers did not work in my project and OP's code was failing too.

    Reviewing source code for ServicePointManager and LocalAppContextSwitches I came across another config setting which worked.

    
      
    
    

提交回复
热议问题