Azure – WCF Could not establish trust relationship for the SSL/TLS secure channel with authority

azureself-signedsslwcf

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?

Best Answer

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

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