Could not establish secure channel for SSL/TLS with authority '*'

前端 未结 9 1604
感情败类
感情败类 2020-12-14 17:59

I must consume a PHP webservice which has a SSL certificate. My .net 3.5 Class library references the webservice with \'Add Service references\' in Visualstudio 2010 (WCF ri

9条回答
  •  有刺的猬
    2020-12-14 18:42

    Problem

    I was running into the same error message while calling a third party API from my ASP.NET Core MVC project.

    Could not establish secure channel for SSL/TLS with authority '{base_url_of_WS}'.

    Solution

    It turned out that the third party API's server required TLS 1.2. To resolve this issue, I added the following line of code to my controller's constructor:

    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
    

提交回复
热议问题