Iis – Configure IIS site to work with host header & hosts file entry

iis

I've set up a site in IIS on my local dev machine.

In the bindings section of the site ive added 4 bindings, all 4 for http:

Host Name                   Port    IP Address
blog.sourcecube.co.za       26581   *
www.blog.sourcecube.co.za   26581   *
blog.sourcecube.co.za       26581   127.0.0.1
www.blog.sourcecube.co.za   26581   127.0.0.1

in my hosts file (drivers\etc\hosts), i've added the folling entries:

127.0.0.1   blog.sourcecube.co.za
127.0.0.1   www.blog.sourcecube.co.za

when i ping my domain name from the command line it does in fact resolve to the loopback address, 127.0.0.1.

So what I'm expecting to happen when i navigate to blog.sourcecube.co.za in my browser is for it to resolve to 127.0.0.1, and when the request hits IIS, it should know which site to serve because of the host header?

But when I navigate to blog.sourcecube.co.za, I get an "Unable to connect, Firefox can't establish a connection to the server at blog.sourcecube.co.za" error.

What am I doing wrong?

Navigating to blog.sourcecube.co.za:26581 from my browser works. I'd like get it working without specifying the port number though.

Best Answer

is the port your mentioning above, the actual port that IIS is listening on? If so, make sure you're entering http://blog.sourcecube.co.za:26581

Your understanding is spot on, so I'm not sure why it would work. What is the specific number error you get? Is it 404, or is it a 500 error?

Edit 1: Pretty simple then, just set your IIS sites to port 80 on any ip address :) Host headers will then take care of the rest. 80 is implied when entering "http", so users wouldn't need to add the port at the end.

See the link below http://support.microsoft.com/kb/308163

IP Address TCP Port Host Header Name

192.168.0.100 80 www.example1.com 192.168.0.100 80 example1.com

Related Topic