如何在IIS Express中启用远程请求?Scott Guthrie写道,这是可能的,但他没有说明如何实现。
当前回答
您可以尝试设置端口转发,而不是尝试修改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
希望能有所帮助。
其他回答
我发现最简单最酷的方法是使用(设置需要2分钟):
https://ngrok.com/
它将与本地主机上运行的任何东西一起工作。只要注册,运行小可执行程序,不管你在localhost上运行什么,你都可以从任何地方访问公共URL。
这对于向远程团队成员显示内容很有好处,无需摆弄IIS设置或防火墙。要停止访问只需终止可执行文件。
ngrok authtoken xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ngrok http -host-header=localhost 89230
假设89230是您的IIS Express端口
您也可以运行多个端口,甚至在免费计划
如果你尝试过Panic上校的答案,但在Visual Studio中不起作用,试试这个:
在IIS Express配置中附加另一个<binding />
<bindings>
<binding protocol="http" bindingInformation="*:8080:localhost" />
<binding protocol="http" bindingInformation="*:8080:hostname" />
</bindings>
最后,你必须以管理员的身份运行Visual Studio
我做了以下操作并成功连接:
1)将IIS快速配置绑定从本地主机更改为“*”
绑定协议="http" bindingInformation="*:8888:*"
2)在防火墙上定义入站规则,允许特定的端口用于协议类型:tcp
3)添加以下命令为您的端口添加网络配置: Netsh HTTP添加urlacl url=http://*:8888/ user=everyone
如果你正在使用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 Professional 2015中安装“输送机by Keyoti”解决了这个问题。输送机生成一个远程地址(您的IP),端口(45455)支持外部请求。例子:
输送机允许您从网络上的外部平板电脑和手机或Android模拟器测试web应用程序(没有http://10.0.2.2:<hostport>)
操作步骤如下:
https://marketplace.visualstudio.com/items?itemName=vs-publisher-1448185.ConveyorbyKeyoti
推荐文章
- 实体框架核心:在上一个操作完成之前,在此上下文中开始的第二个操作
- 如何为构造函数定制Visual Studio的私有字段生成快捷方式?
- 如何使用JSON确保字符串是有效的JSON。网
- AppSettings从.config文件中获取值
- 通过HttpClient向REST API发布一个空体
- 如何检查IEnumerable是否为空或空?
- 自动化invokerrequired代码模式
- 在c#代码中设置WPF文本框的背景颜色
- 在c#中,什么是单子?
- c#和Java中的泛型有什么不同?和模板在c++ ?
- c#线程安全快速(est)计数器
- 如何将此foreach代码转换为Parallel.ForEach?
- 如何分裂()一个分隔字符串到一个列表<字符串>
- 如何转换列表<字符串>列表<int>?
- c#对象列表,我如何得到一个属性的和