Thursday 18 April 2013

Fixing WSDL addresses in WCF 3.5 hosted on IIS 7 and using SSL

Problem

I needed to host a WCF 3.5 web service on IIS 7 (running on Windows Server 2008) using SSL. In fact the service was configured to use wsHttpBinding with TransportWithMessageCredential. The service was running on a public facing web server with a registered domain name.

The problem was usual one; having navigated to .svc file in a browser the service description page showed the WSDL URL to be using the machine name, not the domain name. When viewing the generated WSDL the service location was also using the machine name.

Solution

The web site bindings had been set up in IIS for HTTP and HTTPS. It appears that when the HTTPS binding is setup the host name is not set. You cannot set this using the Internet Information Services (IIS) Manager so you have to do it by other means.

 

image

To add the host name to the HTTPS binding do the following:

  1. Open the applicationHost file located in C:\Windows\System32\inetsrv\config.
  2. Locate the section for the website in question (you can see the web site name in the Internet Information Services (IIS) Manager).
  3. Find the https binding and change the bindingInformation by adding the domain name after “:443:”.
  4. Save the applicationHost file and restart IIS.

 

Now when you view the service .svc file in a browser and the generated WSDL the domain name will appear in place of the machine name.

Thursday 18 April 2013,