The request was aborted: Could not create SSL/TLS secure channel. | System.Net.WebException

我只是一个虾纸丫 提交于 2019-12-11 06:18:38

问题


My webApi is using a third party web api Service inside it. The thing is it's perfectly working in my local machine and Azure web Service. but when I transfer this solution in to Azure Vm instance it's getting this error. I have installed correct certificates related to that 3rd party web api and registered with HttpClient and tried with

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11;

But it's giving the same error. I don't know what is the exact error. Could any one help on this please?


回答1:


Per my understanding, you could refer to the following approach to check this issue:

1.Leverage https://www.ssllabs.com/ssltest/ to check the supported Protocols both on your side and third-party Web API as follows:

2.Configure SecurityProtocol and ServerCertificateValidationCallback as follows:

ServicePointManager.Expect100Continue = true;
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
            | SecurityProtocolType.Tls11
            | SecurityProtocolType.Tls12
            | SecurityProtocolType.Ssl3;

Also, you could refer to this similar issue1 and issue2 for more details.



来源:https://stackoverflow.com/questions/41720564/the-request-was-aborted-could-not-create-ssl-tls-secure-channel-system-net-w

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!