System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
I got below error while calling web api on https and found the solution.
Error
System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
Solution
I solved this error by adding this line before calling the web method:System.Net.ServicePointManager.ServerCertificateValidationCallback = (senderX, certificate, chain, sslPolicyErrors) => { return true; };
Hope this will help you and save your time.
Enjoy !!!
:)
No comments:
Post a Comment