1

据我了解,VS2012默认自带IIS Express版本。它允许您使用 IP 地址连接到开发站点。目前我可以使用http://localhost:22222. 但这不会使用 this http://xxx.xxx.xxx.xxx:22222where xxx 只是开发机器的本地 IP 进行连接。我已验证 IIS Express 正在运行并正在使用中。IE 错误是 http 400 错误请求。

4

3 回答 3

1

I know you have asked question since a long time. I have an answer to this question at this link.

Go to your IISExpress>Config folder, locate applicationhost.config. Change <bindings> as below:

<bindings>
      <binding protocol="http" bindingInformation="*:1407:YOUR_IP_ADDRESS" />
</bindings>

Before you do this , you will have to register this IP address using netsh command as below:

If you’re running Windows 7, pretty much all incoming connections are locked down, so you need to specifically allow incoming connections to your application. First, start an administrative command prompt. Second, run these commands, replacing 192.168.1.11:1234 with whatever IP and port you are using:

> netsh http add urlacl url=http://192.168.1.11:1234/ user=everyone

This just tells http.sys that it’s ok to talk to this url.

> netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=1234 profile=private remoteip=localsubnet action=allow

This adds a rule in the Windows Firewall, allowing incoming connections to port 58938 for computers on your local subnet.More information at this link.

Note: Be sure to change the bindings of your project only by locationg its name. You can even keep the localhost binding and add a new one , this way you can access same webpage using the given IP address.

于 2013-08-25T14:22:00.747 回答
0

对我有用的解决方案是这个

为我解决此问题的一件事是<bindings>在 applicationhost.config 文件中为我的站点部分使用以下行:

<bindings>
    <binding protocol="http" bindingInformation="*:8099:" />
</bindings>

关键是简单地删除本地主机。不要用星号替换它,不要用 IP 或计算机名称替换它。冒号后留空即可。

这样做之后,我就不需要以管理员身份运行Visual Studio了,我可以自由地将项目属性中的Project Url更改为本地IP或计算机名。然后我设置了端口转发,它可以访问 Internet。

编辑:

我发现了另一个对让 IIS Express 正确处理外部请求很重要的怪癖。

如果您以管理员身份运行 Visual Studio/IIS Express,则不得使用“netsh http add urlacl ...”命令向 HTTP.SYS 添加预留。这样做会导致 HTTP 503 Service Unavailable 错误。删除您在 URLACL 中所做的任何保留以解决此问题。

如果您没有以管理员身份运行 Visual Studio/IIS Express,则必须向 URLACL 添加预留。

于 2014-02-28T01:10:50.683 回答
0

它位于哪里?应用程序主机.config :)

这里

%userprofile%\Documents\IISExpress\config 文件夹

或者

%userprofile%\My Documents\IISExpress\config 文件夹

于 2021-06-14T09:30:38.587 回答