Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

networking - Accessing a local website from another computer inside the local network in IIS 7

Ok, so here is the scenario:

I have computer A inside my local network running IIS 7. I added a new website, let's say samplesite.local, through IIS Manager, and edited the hosts file inside %systemroot%system32driversetc with this new line:

127.0.0.1 samplesite.local

So, in a browser running in computer A, if I type samplesite.local in the address bar and hit Enter, everything works fine. I can access the website.

Now I wanted to access this website from other local computers, say, computer B or an iPad, not from the outside world, but from inside the same local network.

Any thoughts?

Edit: Computer A's IP is 192.168.1.100, and samplesite.local is running on port 80. However, if I type 192.168.1.100 in any computer's browser's address bar, I'm taken to the default IIS website, the one with the IIS logo, whose physical address is C:inetpubwwwroot, not to samplesite.local.

question from:https://stackoverflow.com/questions/21896534/accessing-a-local-website-from-another-computer-inside-the-local-network-in-iis

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Add two bindings to your website, one for local access and another for LAN access like so:

Open IIS and select your local website (that you want to access from your local network) from the left panel:

Connections > server (user-pc) > sites > local site

Open Bindings on the right panel under Actions tab add these bindings:

  1. Local:

    Type: http
    Ip Address: All Unassigned
    Port: 80
    Host name: samplesite.local
    
  2. LAN:

    Type: http
    Ip Address: <Network address of the hosting machine ex. 192.168.0.10>
    Port: 80
    Host name: <Leave it blank>
    

Voila, you should be able to access the website from any machine on your local network by using the host's LAN IP address (192.168.0.10 in the above example) as the site url.

NOTE:

if you want to access the website from LAN using a host name (like samplesite.local) instead of an ip address, add the host name to the hosts file on the local network machine (The hosts file can be found in "C:WindowsSystem32driversetchosts" in windows, or "/etc/hosts" in ubuntu):

192.168.0.10 samplesite.local


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...