且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从IIS 7中本地网络内的另一台计算机访问本地网站

更新时间:2022-04-03 22:54:55

为您的网站添加两个绑定,一个用于本地访问,另一个用于LAN访问,如下所示:

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

打开IIS并选择您的从左侧面板本地网站(您要从本地网络访问):

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 >本地网站

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

操作标签下右侧面板上打开绑定
添加以下绑定:

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


  1. 本地:

  1. Local:


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



  • LAN:

  • LAN:


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



  • Voila ,您应该可以使用主机的LAN IP地址(上例中的192.168.0.10)作为站点网址,从本地网络上的任何计算机访问该网站。

    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.

    注意:

    如果您想使用主机名(如samplesite.local)而不是IP地址从LAN访问网站,将主机名添加到本地网络计算机上的hosts文件中(主机文件可以在Windows中的C:\ WindowsD.System32 \drivers \ etcc \ hosts中找到或者ubuntu中的/ etc / hosts

    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:\Windows\System32\drivers\etc\hosts" in windows, or "/etc/hosts" in ubuntu):


    192.168.0.10 samplesite.local

    192.168.0.10 samplesite.local