SSL WCF "Failed to establish trust for SSL / TLS secure channel with localhost authority

I have a WCF web service that works fine with an http address, but since then I have to make sure it works via https.

Since I use IIS 7, the process was quite simple to link the https website using this guide here

I opened the browser and received the usual security hints, but after I added the exception, everything worked.

Then I decided to install the certificate, because the certificate is the local host, the server and the client are the same machine - and let the wizard automatically detect the location.

I returned to my WCF CLIENT code, it is a client that calls web services hosted in IIS (now https), and changed the binding in 2 places.

  • Endpoint address changed to https
  • Security mode for transport changed

Change the code and then get this error:

"Failed to establish trust for the SSL / TLS secure channel with localhost authority."

Finally, I returned to IIS and under SSL settings, changed the setting to accept client certificates, and tried to check whether or not the same error is being produced at the same time.

Any idea how to fix this?

Update Patch 1 has been fixed - this was due to the fact that the certificate was sent to machine_name and I used localhost in the configuration.

Now that this works, I have another problem:

There was no endpoint listening in https: // [machine_name] /Downloads.svc that could receive this message. This is often caused by the wrong address or SOAP action. See InnerException, if available, for more details. "

Internal exception = "The remote server responded with an error: (404) Not found."

Checked the web.config of the IIS site and changed the DNS bindings to localhost.

Still fun with this, but, according to Microsoft, that’s why WCF should be good because it separates transport from coding logic, but so far I have to tell you that it seems very complicated.

Refresh

turned off the Windows firewall, did not help ...

Here is my binding in web.config

<basicHttpBinding> <binding name="IncreasedTimeout" closeTimeout="12:00:00" openTimeout="12:00:00" receiveTimeout="12:00:00" maxReceivedMessageSize="1000000" sendTimeout="12:00:00"> <security> <transport></transport> </security> </binding> </basicHttpBinding> 
+7
c # ssl iis wcf
source share
1 answer

You will most likely need to add explicit base addresses for both protocols so that WCF knows that you want to bind them to both. Try adding this to your <service> definition:

 <host> <baseAddresses> <add baseAddress="http://your-hostname-here/" /> <add baseAddress="https://your-hostname-here/" /> </baseAddresses> </host> 

Also, make sure that you are accessing the service through the WINS / DNS name of the machine, or if you need to add an explicit host header to the website instance in IIS.

+2
source share

All Articles