Archive for March, 2011

Breaking out of HTTP.SYS hell

I am working on using SSL with WCF and when it came time for me to add a service reference for my project I kept getting the following error: “This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case.

I was able to access my SVC file in a browser using the new domain certificate I had created for the service website.  The certificate was issued by our domain certificate authority.   I was also able to access the WSDL file as well with no problems.

SecureService Service SVC File

SecureService Service SVC File

So, why was I getting an error when trying to create a service reference?  Because the web site’s http binding did not have a host header.  To add a host header to your website, open IIS Manager and click on the web site you want to configure.

IIS Manager

Next, click on the bindings link to open the Site Bindings dialog box.  Find the http type, click on it and then click on the edit button on the right to open the Edit Site Binding dialog box.

Site Bindings Dialog Box

In the Host name edit control, enter the friendly name you used when creating the certificate.  Don’t enter http or https.  Click ok.  Click Close to close the Site Bindings dialog box.

Edit Site Binding

Edit Site Binding

Now go back to your client and click on Service References and right click to get the popup menu and then click on Add Service Reference.  In the Address: edit control enter the URL of your service, and in the Namespace enter in the name you want for your service reference and then click go.

Add Service Reference

Add Service Reference

You should get a windows login dialog box.  Provide your login credentials and click on and you now have your service reference.

I don’t have a lot of experience with host headers other than having to use them when you only have a single IP address and want multiple web sites (not virtual websites, but top level websites) to share it.  When given a choice,  I opt for adding multiple IP’s on a NIC and then every website gets a separate IP Address and separate DNS address.

However, I guess now there are other reasons for using host headers, and breaking out of HTTP.SYS hell is one of them.

Categories: IIS, Programming, SSL, WCF
%d bloggers like this: