配置IISExpress容许外部访问

1.找到IISExpress的配置文件,位于 <文档>/IISExpress/config文件夹下,打开applicationhost.config,找到以下代码:
[html]  view plain  copy
 
  1. <site name="WebSite1" id="1" serverAutoStart="true">  
  2.       <application path="/">  
  3.            <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />  
  4.       </application>  
  5.       <bindings>  
  6.            <binding protocol="http" bindingInformation=":8080:localhost" />  
  7.       </bindings>  
  8. </site>  
 其中name是你Web项目的名称,找到对应你项目的配置,而后在 
[html]  view plain  copy
 
  1. <binding protocol="http" bindingInformation="*:8080:localhost" />  
后面加上
[html]  view plain  copy
 
  1. <binding protocol="http" bindingInformation="*:8080:192.168.1.1" />  
其中192.168.1.1改成你本身的Ip地址,8080改成你本身的端口

2.按上面改成后,当你经过IP地址访问时可能会出现400错误,若是出现,就采用下面的方法:
(1)以管理员身份打开CMD命令窗口
(2)输入以下命令:
[plain]  view plain  copy
 
  1. netsh http add urlacl url=http://192.168.1.1:8080/ user=everyone  
一样,将IP地址和端口改成你本身的。若是报错请确认是不是以管理员身份运行的CMD。重启IISExpress,此时应该就可使用IP地址访问了
 
3..完成上面两部以后,因为防火墙的缘由,其余的电脑可能还没法访问你的服务器,若是出现这种状况,采用下面的方法(这里系统是win8.1)
(1)控制面板(查看方式选择类别)->系统和安全->Windows防火墙,在左侧选择高级设置
(2)右击入站规则->新建规则->端口->特定本地端口处输入8080->容许链接->3个选项全选->输入新规则名称->完成
如今外部程序就能够访问你的IISExpress了
相关文章
相关标签/搜索