When IIS responds to an HTTP request is uses 3 pieces of information to figure out what web site it should use to build the response.
- IP address - The browser uses the name in the address bar to perform a DNS query and get the actual IP address of the host. It sends the http request to that IP address.
- Port - By default this is 80 for non SSL requests and 443 for SSL.
- host header - Part of an http request is a host header. This host header matches the domain name of the address requested by the user, including sub-domain or host names. For example:
www.foo.com secure.foo.com server1.foo.com subdomain.foo.com server2.subdomain.foo.com
, etc.
Assumptions based on your question:
1 - Your machine has 3 ip addresses assigned:
- 192.168.1.250 - assigned as web site 1, name WS1
- 192.168.1.249 - assigned as web stie 2, name WS2
- both WS1 and WS2 are defined in IIS and mapped to the appropriate IP address
2 - You have a 3rd ip address assigned to your machine that is the original IP address. (This may or may not be the case, I'm assuming it to be so since that's what most folks do when the assign IP's to web sites).
3 - The default web site in IIS has the IP address setting of: (All Unassigned)
.
4 - You have not specified any host headers or ports in your IIS config.
So, when running a browser on your machine you type: http://localhost
(no port number), what does IIS do?
Per previous replies the browser converts localhost to 127.0.0.1 as the IP address and constructs an HTTP request for that IP address. The host header will be localhost
.
In this scenario IIS will see that both WS1 and WS2 do not have matching ip addresses and so the default site will be used to process the request.
If you wish to have WS1 or WS2 respond to the request, disable the default site and change the IP address setting to (All Unassigned)
for either WS1 or WS2.