Showing posts with label Exchange Server 2010. Show all posts
Showing posts with label Exchange Server 2010. Show all posts

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 !!!