C# – The request was aborted: Could not create SSL/TLS secure channel for HttpWebRequest

asmxasp.netcnet

I am using an asmx webservice client to connect to a backend web service and we have multiple environments .In one of the server ,am getting error "The request was aborted: Could not create SSL/TLS secure channel" but every other environments it works fine. I referred below articles already and none of it helped.

The request was aborted: Could not create SSL/TLS secure channel.

The request was aborted: Could not create SSL/TLS secure

HttpWebRequest: The request was aborted: Could not create SSL/TLS secure channel

HttpWebRequest The request was aborted: Could not create SSL/TLS secure channel

Best Answer

If the issue is server specific ,you may be running into any issue with Server Certification validation check (because of the Root Certificate missing) or CRL check failure ,then following code might help.Add this to your project and verify

ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => true;

Please note that this is not a good way as we are just making all the ServerCertificateValidation always true .

If server validation is the issue,the correct way to do is to make sure your you can successfully access the https url from the machine.You can browse to the URL using any browser and it should be successfully be able to browse without any warning.if any warning comes(e.g. certificate not trusted),verify the error and make sure you have the required root certificate installed etc

Hope this helps!