How to access localhost website from another computer?

1

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.

user466663

Posted 2014-11-06T23:12:09.617

Reputation: 111

localhost is 127.0.0.1 and not the same as the local IP of the machine. You need to bind to the local IP instead. – Tyson – 2014-11-06T23:18:30.470

Yes, I tried my ip address also. It didn't work! – user466663 – 2014-11-06T23:29:21.847

right that's what i said =] It's not the same thing as... anyways you got answer that explains in more detail now. – Tyson – 2014-11-06T23:35:07.660

Answers

2

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.

Jeeped

Posted 2014-11-06T23:12:09.617

Reputation: 2 435

I understand what you have mentioned. But don't know how to make it to work. Strangely if I try http://127.0.0.1/<mypage.aspx> also doesn't work! my host file entry is given below: 127.0.0.1 loclahost ::1 localhost

– user466663 – 2014-11-06T23:38:19.100

1

@user466663 - Have a look at Add a Binding to a Site (IIS 7) for more information. (and to the drive-by-downvoter, how about explaining the diss?)

– Jeeped – 2014-11-06T23:43:47.993

i used up up-vote to counter act the down vote, there is no reason for this answer to be down voted. – Tyson – 2014-11-07T15:26:44.193