如何让局域网其它电脑访问自己电脑上IISExpress上的网站

最近IIS坏了 没法部署网站 ,但又要跟前端同事联调接口调试代码,没办法只能采用VS自带的IISExpress来调试了,问题IISExpress这个默认局域网是没法访问的。百度一圈后终于找到了方案。在这里记录下以便后续查阅。

1、首先启动IISExpress

     

 或

  

2、修改配置

  

 打开配置文件修改site节点,在bindings节点增加 <binding protocol="http" bindingInformation="*:20002:172.17.0.65" />

 172.17.0.65 这个IP就是你本机局域网IP ,这个地址也可以用星号(*)

<site name="SFLIS.API" id="3">
     <application path="/" applicationPool="Clr4IntegratedAppPool">
           <virtualDirectory path="/" physicalPath="D:\Work\SourceCode\hmyweb\SFLIS.API" />
     </application>
     <bindings>
           <binding protocol="http" bindingInformation="*:20002:localhost" />
           <binding protocol="http" bindingInformation="*:20002:172.17.0.65" />
     </bindings>
</site>

  

3、设置局域网访问权限

   添加访问权限:

netsh http add urlacl url=http://172.17.0.65:20002/ user="NT AUTHORITY\INTERACTIVE"

netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=20002 profile=private remoteip=localsubnet action=allow

  

 删除访问权限: 

netsh http delete urlacl url=http://172.17.0.65:20002/

netsh advfirewall firewall delete rule name="IISExpressWeb"

  

4、重启IISExpress 、如果有防火墙须添加入站规则

posted @ 2019-12-05 16:49  Jack.Cai  阅读(724)  评论(0编辑  收藏  举报