What is your “localhost”?
In computer networking, localhost (meaning this computer) is the standard hostname given to the address of the loopback network interface. This mechanism is useful for developers to test their software.
The default address for localhost is 127.0.0.1. This special IP address, also called the Loopback Address, is always defined to mean “the current machine”. It is not the same thing as the external IP address of your web server:
Localhost is configurable in the Hosts file (typically located at C:WindowsSystem32DriversEtcHosts). Due to multiple dependencies, it is usually not recommended to reconfigure it.
Instead, you can set up alternate domains in your Hosts file. For example, you could set
192.168.1.250 my.internal.website.com
192.168.1.249 your.internal.website.net
How Does “localhost” Relate To IIS ?
Internet Information Services (IIS) – is a web server software application created by Microsoft for use with Microsoft Windows.
If IIS is expecting a connection to IP address 192.168.1.250, then a connection to 127.0.0.1 will not match. When IIS responds to an HTTP request, it 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.