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


当前回答

您可能需要做三个更改。

告诉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”应用程序“/”

其他回答

对于我来说,使用这个相对简单,直接:

通过在扩展对话框中搜索“输送机”下载Visual Studio扩展。然后就安装。

形式: https://marketplace.visualstudio.com/items?itemName=vs-publisher-1448185.ConveyorbyKeyoti

结合这个帖子中的答案,这是我如何修复它(Visual Studio 2019):

以管理员身份启动Visual Studio,并像往常一样运行Web服务。 在任务栏上找到IIS Express图标,右键单击它,然后单击“显示所有应用程序”。 选择您的Web服务并注意下面显示的配置路径。单击配置文件以打开它进行编辑。 在这个配置文件中找到您的web服务(例如搜索您的端口),然后找到如下一行: *: yourport: localhost 在这之后添加新的一行,像这样: : yourport: *

在这种情况下,不需要使用将来可能会改变的特定ip地址创建绑定。

我希望这能帮助到一些人。

顺便说一句:

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

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

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

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

如果你正在使用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

在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)