如何在IIS Express中启用远程请求?Scott Guthrie写道,这是可能的,但他没有说明如何实现。


当前回答

如果你正在使用Visual Studio,那么按照以下步骤通过ip地址访问IIS-Express:

Get your host IP-Adress: ipconfig in Windows Command Line GoTo $(SolutionDir)\.vs\config\applicationHost.config Find <site name="WebApplication3" id="2"> <application path="/" applicationPool="Clr4IntegratedAppPool"> <virtualDirectory path="/" physicalPath="C:\Users\user.name\Source\Repos\protoype-one\WebApplication3" /> </application> <bindings> <binding protocol="http" bindingInformation="*:62549:localhost" /> </bindings> </site> Add: <binding protocol="http" bindingInformation="*:62549:192.168.178.108"/> with your IP-Adress Run your Visual Studio with Administrator rights and everything should work See post from Andrii how to configure Firewall: here

其他回答

我发现最简单最酷的方法是使用(设置需要2分钟):

https://ngrok.com/

它将与本地主机上运行的任何东西一起工作。只要注册,运行小可执行程序,不管你在localhost上运行什么,你都可以从任何地方访问公共URL。

这对于向远程团队成员显示内容很有好处,无需摆弄IIS设置或防火墙。要停止访问只需终止可执行文件。

ngrok authtoken xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

ngrok http -host-header=localhost 89230

假设89230是您的IIS Express端口

您也可以运行多个端口,甚至在免费计划

顺便说一句:

netsh http add urlacl url=http://vaidesg:8080/ user=everyone

这只适用于英文版的Windows。如果你正在使用本地化版本,你必须用其他东西替换“everyone”,例如:

在使用荷兰语版本时是“Iedereen” 使用德语版本时使用“Jeder” 当使用匈牙利语版本时,“Mindenki”

否则你会得到一个错误(创建SDDL失败,错误:1332)

我做了以下操作并成功连接:

1)将IIS快速配置绑定从本地主机更改为“*”

绑定协议="http" bindingInformation="*:8888:*"

2)在防火墙上定义入站规则,允许特定的端口用于协议类型:tcp

3)添加以下命令为您的端口添加网络配置: Netsh HTTP添加urlacl url=http://*:8888/ user=everyone

您可能需要做三个更改。

告诉IIS Express本身绑定到所有ip地址和主机名。在你的。config文件中。通常: VS 2015: $ (solutionDir) \ .vs \ config \ applicationhost.config < VS 2015: %userprofile%\My Documents\IISExpress\config\applicationhost.config

找到站点的绑定元素,然后添加

    <binding protocol="http" bindingInformation="*:8080:*" />

设置Windows中名为“http.sys”的部分。以管理员身份执行如下命令:

    netsh http add urlacl url=http://*:8080/ user=everyone

每个人都是一个windows组。对于有空格的组使用双引号,如“Tout le monde”。

允许IIS Express通过Windows防火墙。 启动/ Windows防火墙高级安全/入站规则/新规则… 程序%ProgramFiles%\IIS Express\iisexpress.exe 或端口8080 TCP

现在,当您启动iisexpress.exe时,您应该看到如下消息

成功注册网址“http://*:8080/”网站“hello world”应用程序“/”

在IIS团队网站上有一篇博客文章解释了如何在IIS Express上启用远程连接。以下是那篇文章的相关部分总结:

在Vista和Win7上,在管理提示符下运行以下命令: Netsh HTTP添加urlacl url=http://vaidesg:8080/ user=everyone 对于XP系统,首先安装Windows XP Service Pack 2 Support Tools。然后在管理提示符下运行以下命令: httpcfg set urlacl /u http://vaidesg1:8080/ /a D:(a;;GX;;;WD)