首先在 Visual Studio 中打开 applicationhost.config 文件。地址>>C:\Users\Your User Name\Documents\IISExpress\config\applicationhost.config
然后找到这段代码:
<site name="Your Site_Name" id="24">
<application path="/" applicationPool="Clr4IntegratedAppPool"
<virtualDirectory path="/" physicalPath="C:\Users\Your User Name\Documents\Visual Studio 2013\Projects\Your Site Name" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:Port_Number:*" />
</bindings>
</site>
*)Port_Number:当您的站点在您的计算机上运行在 IIS express 中时,端口号将显示在浏览器的地址栏中,如下所示:localhost:port_number/... 编辑此文件时保存它。
在第二步中,您必须以管理员身份运行 cmd 并键入以下代码:netsh http add urlaclurl=http://*:port_Number/ user=everyone
并按 Enter
在第三步中,您必须在防火墙上启用端口
Go to the “Control Panel\System and Security\Windows Firewall”
Click “Advanced settings”
Select “Inbound Rules”
Click on “New Rule …” button
Select “Port”, click “Next”
Fill your IIS Express listening port number, click “Next”
Select “Allow the connection”, click “Next”
Check where you would like allow connection to IIS Express (Domain,Private, Public), click “Next”
Fill rule name (e.g “IIS Express), click “Finish”
我希望这个答案对你有用
此链接中的 Visual Studio 2015 更新:
https ://johan.driessen.se/posts/Accessing-an-IIS-Express-site-from-a-remote-computer