0
votes

Scenario:

I've a WCF web service called SERVICEA hosted in Azure. It's uses self signed certificate for HTTPS. This SERVICEA inspect the incoming request and determines whether to call:

  1. SERVICEB OR
  2. SERVICEC

Both SERVICEB AND SERVICEC also uses self signed cert. for https.

PROBLEM:

When I deploy the SERVICEA and try to call so that it invokes SERVICEB I get the error message below:

*

Could not establish trust relationship for the SSL/TLS secure channel with authority "SERVICEB..."

*.

Note it says SERVICEB.. on error message.

Anyidea how I can resolve this issue, please?

3
could anyone please helpNil Pun

3 Answers

2
votes

You need to validate the server certificate if its self signed as shown below:

ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, error) => true;
0
votes

You want to trap the ServerCertificateValidationCallback and make it ignore certificates of your choosing. Here is a decent article that explains how: http://blog.jameshiggs.com/2008/05/01/c-how-to-accept-an-invalid-ssl-certificate-programmatically/

0
votes

Rajesh is onto something, but his answer disables certification checks altogether.

Instead I would suggest an event handler like the following should be added to your application:

ServicePointManager.ServerCertificateValidationCallback +=  (sender, certificate, chain, errors) =>
{
    var request = sender as HttpWebRequest;
    if (request != null && request.Address.Host == "<Your domain name goes here>")
        return true;

    return errors == SslPolicyErrors.None;
};