无法使用IP地址连接到IIS Express [英] Can't connect to IIS Express using IP Address
问题描述
据我了解,VS2012默认带有IIS Express版本.并且它允许您使用IP地址连接到开发站点.目前,我可以使用 http://localhost:22222
进行连接.但这无法使用此 http://xxx.xxx.xxx.xxx:22222
进行连接,其中xxx只是开发计算机的本地IP.我已验证IIS Express是否正在运行并正在使用中.IE错误是http 400错误请求.
From what I understand, VS2012 comes with the IIS Express version by default. And it allows you to connect to the development site using IP address. Currently I can connect using http://localhost:22222
. But this would not connect using this http://xxx.xxx.xxx.xxx:22222
where xxx just a local IP of the development machine . I have verified that the IIS Express is running and being used. The IE error was http 400 bad request.
推荐答案
I know you have asked question since a long time. I have an answer to this question at this link.
转到您的 IISExpress> Config
文件夹,找到 applicationhost.config
.更改< bindings>
如下:
Go to your IISExpress>Config
folder, locate applicationhost.config
. Change <bindings>
as below:
<bindings>
<binding protocol="http" bindingInformation="*:1407:YOUR_IP_ADDRESS" />
</bindings>
在执行此操作之前,您将必须使用 netsh
命令注册此IP地址,如下所示:
Before you do this , you will have to register this IP address using netsh
command as below:
如果您运行的是Windows 7,则几乎所有传入连接都被锁定,因此您需要专门允许传入连接到您的应用程序.首先,启动管理命令提示符.其次,运行以下命令,将192.168.1.11:1234替换为您使用的IP和端口:
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
这只是告诉 http.sys
可以与该URL对话.
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
这会在Windows防火墙中添加一条规则,允许本地子网中的计算机的传入连接到端口58938.有关详细信息,请参见此链接.
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.
注意:请确保仅通过名称更改位置来更改项目的绑定.您甚至可以保留localhost绑定并添加一个新的localhost,这样您就可以使用给定的IP地址访问同一网页.
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.
这篇关于无法使用IP地址连接到IIS Express的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!