Wednesday, March 16, 2011

The request failed. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

I tried to retrive data from Exchange Server 2010 using Exchange API 1.0 but below error fire

Error:
The request failed. The underlying connection was closed: Could not establish trust relationship  for the SSL/TLS secure channel.

Solution:
Add below code before access web service
ServicePointManager.ServerCertificateValidationCallback += delegate(object sender,
                X509Certificate certificate,
                X509Chain chain,
                SslPolicyErrors sslPolicyErrors)
            {
                return true;
            };
This Error occur when you access Secure Web Service.

Happy Coding !!!

No comments:

Post a Comment