使用IIS Express来托pipe一个网站(暂时)

我有一个网站(MVC3),这是用于发展的IIS Express中托pipe。 (我遇到了一个卡西尼Devserver的错误,不得不升级…)现在,我想知道,是否有可能让我的本地networking(路由器后面)的其他机器看到我的机器上托pipe的网站? (例如,如果我写http://my.local.ip:端口到浏览器在同一个局域网上,因为我将页面加载?

默认情况下,IIS Express只提供本地主机请求。 编辑applicationhost.config文件(位于%userprofile%\documents\iisexpress\config\ )并将localhost更改为'*'或您的计算机名称。 (记住非本地主机绑定,您必须以pipe理员身份运行或以pipe理员身份设置URL acl,然后以非pipe理员身份运行iisexpress)

或者,您可以使用像AnalogX的PortMapper一样的东西作为一个小型的环回代理,将私有的本地主机绑定端口隧道到公开的端口。

例如,

  • IISExpress本地绑定到本地主机:8080
  • 端口映射器端口9090被configuration为将stream量中继到本地主机:8080

实际上,端口9090上的任何连接(由PortMapper打开)都将通过本地主机:8080 ; 从而绕开了所有可能会让人痛苦的无聊话题。

以下是我的configuration:

PortMapper配置

使用这种代理方法的好处是,它不会永久地暴露本地开发盒上打开的IISExpress端口。

很less有时候我想公开开放这个港口开会。 但大多数时候,端口应该closures,只能由本地主机访问。 每次在路由器上修改防火墙规则都很麻烦。 以下是我如何设置的东西:

  • 我的路由器防火墙转发9090端口到PortMapper
  • 只有在PortMapper正在运行时, PortMapper 才会继续将stream量代理到IISExpress (侦听8080 )。

注意

确保closures所有PortMapper窗口,以使更改生效。

笔记2

正如其他人所描述的,您可能需要为您的应用程序调整IISExpress绑定

  My Documents\IISExpress\applicationhost.config project\.vs\config\applicationhost.config 

像这样的东西:

 <bindings> <!-- bindingInformaiton format: IPToBindTo:Port:DNSHostName --> <!--OLD: <binding protocol="http" bindingInformation="*:8080:localhost"/>--> <!--Change '*' to 127.0.0.1 and remove 'localhost' right of the port number to avoid invalid DNS hostname errors --> <binding protocol="http" bindingInformation="127.0.0.1:8080:" /> </bindings> 

我相信有三个步骤可以做到这一点:

1)添加一个DNS条目或主机条目,以便其他机器可以查找开发机器的IP地址

2)在%userprofile / documents / IISExpress / Config中像这样添加绑定到applicationhost.config

 <site name="MobileDashboard(2)" id="7"> <bindings> ... <binding protocol="http" bindingInformation="*:yourport#:yourmachinendnsname" /> </bindings> </site> 

3)运行在这里find的命令,以允许传入的请求:

 netsh http add urlacl url=http://yourmachinendnsname:yourport#/ user=everyone 

在这个线程的答案是伟大的,它只是没有防火墙的例外。

 netsh advfirewall firewall add rule name="IIS Express (non-SSL)" action=allow protocol=TCP dir=in localport=8000 netsh advfirewall firewall add rule name="IIS Express (SSL)" action=allow protocol=TCP dir=in localport=44300 

来自评论@ http://blogs.iis.net/vaidyg/archive/2010/07/29/serving-external-traffic-with-webmatrix-beta.aspx

是的,你可以configuration尽可能多的网站使用iis快递本地局域网使用这里是链接访问本地网站从Lan IIS Express解释如何实现这一点。