如何在IIS Express中启用远程请求?Scott Guthrie写道,这是可能的,但他没有说明如何实现。
当前回答
我做了所有这些步骤,但都无济于事。 我需要的是,它只是通过IIS Express运行我的应用程序…
希望能有所帮助。
其他回答
我用反向代理的方法解决了这个问题。
我安装了wamp服务器,使用了apache web服务器的简单反向代理功能。
我添加了一个新的端口来监听Apache web服务器(8081)。然后我为该端口添加了虚拟主机代理配置。
<VirtualHost *:8081>
ProxyPass / http://localhost:46935/
ProxyPassReverse / http://localhost:46935/
</VirtualHost>
我已经启用了本地IIS,所以我刚刚创建了一个重写规则到我的调试端口…我认为这比其他方法更好,更酷,因为它更容易删除一旦我完成开发…下面是重写的样子。
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="^dev/(.*)" />
<action type="Rewrite" url="http://localhost:47039/{R:1}" />
</rule>
</rules>
</rewrite>
VS也允许你直接使用本地IIS进行开发(然后允许远程连接),但是反过来你必须总是以管理员身份运行它…我不喜欢那样。
您可能需要做三个更改。
告诉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 Express配置,添加新的HTTP。sys规则或以管理员身份运行Visual Studio。
基本上,你需要将你的网站运行的IP:PORT转发到你机器上的其他空闲端口,但在外部网络适配器上,而不是localhost。
问题是IIS Express(至少在Windows 10上)绑定到[::1]:port,这意味着它侦听IPv6端口。你需要考虑到这一点。
以下是我如何做到这一点- http://programmingflow.com/2017/02/25/iis-express-on-external-ip.html
希望能有所帮助。
如果你正在使用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
推荐文章
- 实体框架核心:在上一个操作完成之前,在此上下文中开始的第二个操作
- 如何为构造函数定制Visual Studio的私有字段生成快捷方式?
- 如何使用JSON确保字符串是有效的JSON。网
- AppSettings从.config文件中获取值
- 通过HttpClient向REST API发布一个空体
- 如何检查IEnumerable是否为空或空?
- 自动化invokerrequired代码模式
- 在c#代码中设置WPF文本框的背景颜色
- 在c#中,什么是单子?
- c#和Java中的泛型有什么不同?和模板在c++ ?
- c#线程安全快速(est)计数器
- 如何将此foreach代码转换为Parallel.ForEach?
- 如何分裂()一个分隔字符串到一个列表<字符串>
- 如何转换列表<字符串>列表<int>?
- c#对象列表,我如何得到一个属性的和