WCF basicHttpBinding and Https

By | January 23, 2011

Running a WCF service (svc) with basicHttpBinding and Https needs some configuration inside the web.config.

First create a website for your service in IIS with a Https (port 443) binding.
For this example, I created a test certificate with makecert.exe.
Https Binding

Now develop your WCF service with default ABC-configuration (Binding = basicHttpBinding). Open the the service in your browser. You should receive this exception:

WCF basicHttpBinding (wrong Config)

With default ABC-configuration (basicHttpBinding) a WCF service doesn’t work over Https.
You have to modify your web.confg. Here is an example of my service.

Transport Level Security - basicHttpBinding
The red marks lift out the “Transport Level Security” configuration.

Now open your service again. The communication is now encrypted! The result should be as follows: (I used an untrusted certificate. Therefore the browser shows an appropriate message. ;))
WCF basicHttpBinding with Https (right Config)