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

后端 未结 1 1702
臣服心动
臣服心动 2020-12-21 11:02

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:

1条回答
  •  隐瞒了意图╮
    2020-12-21 11:45

    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!

    0 讨论(0)
提交回复
热议问题