Windows – How to access localhost website from another computer

iis-7localhostwindows

I am running IIS7 on Windows 8.1. I want to access my asp.net mvc site from another computer within the same local network. I tried my IP address instead of the localhost. I am getting not found 404 error. Strangely, even within my own computer while localhost works the IP address doesn’t work.

Best Answer

The localhost entry in your %SYSTEMROOT%\System32\Drivers\Etc\Hosts file points to 127.0.0.1 like this:

127.0.0.1       localhost

Each individual computer has the same entry. It essentially means me when used by any computer. If your IIS7 is supplying the local web site as localhost then that computer is the only one that will ever be able to reach it. You should be able to add IP addresses to II7's web site properties. In this case you would added the local network IP address of the computer; e.g. 192.168.1.10. The local network IP address can be found from a command prompt by using the IPCONFIG /all command. The preferred IP would be the one connected to a cabled connection although a wireless connection would do. You cannot add an IP address to II7 for the web site that is not already assigned to your computer or it is meaningless. You may also have to open up port 80 (http) and/or 443 (https) on your firewall.

When you have that configured correctly (and refreshed IIS7) then you would access the web site from another computer on your local LAN using ,

http://192.168.0.10/mypage.html

... where 192.168.0.10 is the IP address of the computer that you configured in IIS7 and mypage.html is the page you want to go to.

Related Question