如何在IIS Express中启用远程请求?Scott Guthrie写道,这是可能的,但他没有说明如何实现。
当前回答
我发现最简单最酷的方法是使用(设置需要2分钟):
https://ngrok.com/
它将与本地主机上运行的任何东西一起工作。只要注册,运行小可执行程序,不管你在localhost上运行什么,你都可以从任何地方访问公共URL。
这对于向远程团队成员显示内容很有好处,无需摆弄IIS设置或防火墙。要停止访问只需终止可执行文件。
ngrok authtoken xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ngrok http -host-header=localhost 89230
假设89230是您的IIS Express端口
您也可以运行多个端口,甚至在免费计划
其他回答
我通过在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
我做了所有这些步骤,但都无济于事。 我需要的是,它只是通过IIS Express运行我的应用程序…
希望能有所帮助。
我在win8.1中使用IIS Express和外部请求时遇到一些问题。
我遵循以下步骤调试外部请求:
安装IIS 配置Visual Studio以使用本地IIS (Web项目中的页面属性) 在IIS中创建一个专用的appool来使用我的应用程序 在我的项目中,我使用Oracle客户端,必须是32位(64位不使用Visual Studio),然后我需要在应用程序池中允许32位 配置Windows防火墙以允许端口80中的请求(入站规则)
这是工作!
这是我用Visual Studio 2015为Windows 10启用远程访问所做的,包括http和https:
第一步是将应用程序绑定到内部IP地址。执行cmd -> ipconfig命令获取地址。打开文件/{项目文件夹}/.vs/config/applicationhost。配置并向下滚动,直到你找到像这样的东西:
<site name="Project.Web" id="2">
<application path="/">
<virtualDirectory path="/" physicalPath="C:\Project\Project.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:12345:localhost" />
</bindings>
</site>
在bindings下添加两个新绑定。如果你喜欢,你也可以使用HTTPS:
<binding protocol="http" bindingInformation="*:12345:192.168.1.15" />
<binding protocol="https" bindingInformation="*:44300:192.168.1.15" />
将以下规则添加到您的防火墙,以admin身份打开一个新的cmd提示符,并运行以下命令:
netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=12345 profile=private remoteip=localsubnet action=allow
netsh advfirewall firewall add rule name="IISExpressWebHttps" dir=in protocol=tcp localport=44300 profile=private remoteip=localsubnet action=allow
现在以管理员身份启动Visual Studio。右键单击web项目项目文件并选择属性。进入“Web”页签,单击“创建虚拟目录”。如果Visual Studio不是以管理员身份运行,则可能会失败。现在一切都正常了。
如果你正在使用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
推荐文章
- ASP是什么?NET Identity的IUserSecurityStampStore<TUser>接口?
- net HttpClient。如何POST字符串值?
- 我如何使一个方法的返回类型泛型?
- 何时处理CancellationTokenSource?
- ASP。网网络。config: configSource vs.文件属性
- 如何获取正在执行的程序集版本?
- AutoMapper vs valueinjector
- 为什么控制台不。Writeline,控制台。在Visual Studio Express中编写工作?
- 什么是.NET程序集?
- 字符串不能识别为有效的日期时间“格式dd/MM/yyyy”
- 函数应该返回空对象还是空对象?
- 如何转换日期时间?将日期时间
- 如何在c#中连接列表?
- 在c#中引用类型变量的“ref”的用途是什么?
- 防止在ASP中缓存。NET MVC中使用属性的特定操作