IIS Hosting for WCF Service – Issue when Domain Name is used

Last week we ran into some issues with hosting of WCF Service in IIS 6.0. The issue was when we try to browse the service file (e.g https://MySubDomain.MyDomain.com/MyVirtualFolder/MyService.svc) in browser everything looks fine. However the WSDL definition URL mentioned beside svcutil.exe was displaying https://MyComputerName/MyVirtualFolder/MyService.svc

We did some Google search and found the solution in parts at various place. I though it would be good to put together this information at a single place so that it would be helpful to anyone facing the similar issue.

One important point to note here is that the web site where service is hosted is SSL enabled.

Resolution to this issue is stated in steps below:

#1: Make sure Service Behaviour tag in web.config is configured as mentioned below. Notice the keywords in Bold.

    <serviceBehaviors >
        <behavior name="ExcelClientServiceBehavior" >
            <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
            <serviceDebug includeExceptionDetailInFaults="false" />

#2: The issue might still persist is the Header Name is not properly associated with the Site Identifier. Here our observation was even though in IIS you can see that the Host Header Value displaying your domain name, but still we were getting the issue.

  • Open Command Prompt (Start ->  Run -> cmd)
  • Go to the folder for adsutil.vbs (C:\Inetpub\AdminScripts)
  • Run the below mentioned command
  • cscript.exe adsutil.vbs set /w3svc/<site identifier>/SecureBindings ":443:<host header>"

Replace <host header> with domain name e.g MySubDomain.MyDomain.com as mentioned in above example.

Replace <site identifier> with your web site identifier. For Default Web Site it is generally 1.


We can run the same command with different identifiers for each web site.

Hope you find this post useful.

If anyone has any correction to be made in this post, let me know and I will correct them ASAP.