IISExpress 从远程计算机返回 503 错误
我正在尝试使用本地网络上的一些其他计算机/设备测试在本地 IISExpress 实例中运行的网站。我运行的是Win7专业版。
当我第一次尝试从本地网段上的另一台计算机浏览到我的计算机时,收到 400 错误:主机名无效。
我知道我需要使用提升的命令提示符上的命令授予对 ACL 的远程访问权限,例如:
netsh http add urlacl url=http://mymachinename:50333/ user=everyone
现在我得到了503服务不可用错误。
Windows 防火墙当前已关闭,我可以通过地址 http://localhost:50333
浏览本地 IISExpress 实例
此配置难题的最后一部分是什么?
I'm attempting to test a website I have running in a local IISExpress instance with some other machines / devices on my local network. I am running Win7 Pro.
When I first attempt to browse to my machine from another machine on my local network segment, I get a 400 error: Hostname is invalid.
I understand that I need to grant remote access to the ACL with a command on the elevated command prompt like:
netsh http add urlacl url=http://mymachinename:50333/ user=everyone
Now I get a 503 service is unavailable error.
Windows Firewall is currently shut off, and I am able to browse my local IISExpress instance with the address http://localhost:50333
What is the final piece to this configuration puzzle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
您似乎在 applicationhost.config 文件中缺少绑定信息条目。
打开您的 applicationhost.config 文件。可能的位置是:
%userprofile%\Documents\IISExpress\config\applicationhost.config
$(solutionDir)\.vs\config\applicationhost.config
(VS2015)iisexpress.exe
的输出以确定。找到您的网站条目并添加以下与您的计算机名称的绑定。
重新启动 IIS Express
It looks like you are missing a binding information entry in applicationhost.config file.
Open your applicationhost.config file. Possible locations are:
%userprofile%\Documents\IISExpress\config\applicationhost.config
$(solutionDir)\.vs\config\applicationhost.config
(VS2015)iisexpress.exe
to be sure.Locate your WebSite entry and add following binding with your machine name.
Restart IIS Express
只有一件事对我有用。
使用
*:portnumber:*
是不好的。是的,完成此操作并确保 Windows 防火墙已打开后,我可以连接到该端口,但仍然收到“503”错误。我在本地测试了一些东西,发现只有 http://localhost 有效。使用真实 IP 地址(不是 127.0.0.1,而是 192.168.1.50),即使在本地计算机上仍然返回 503。我尝试在绑定中使用真实主机名,但 IIS Express 拒绝启动。这实际上可能与主机名的解析方式有关。我没有进一步探讨这一点。
最后,我最终使用了这个配置:
这样,我就能够使用
http://192.168.1.50:53351
从远程计算机进行连接。There was only 1 thing that worked for me.
using
*:portnumber:*
was no good. Yes, after doing that and making sure the Windows Firewall was open, I could connect to the port, but I still got the "503" error.I tested a few things locally, and discovered that only http://localhost worked. Using the real IP address (not 127.0.0.1, but, for instance, 192.168.1.50), still returned a 503 even on the local machine. I tried using the real host name in the bindings, but IIS Express refused to start. This may actually have something to do with how the host name was being resolved. I didn't explore that further.
Finally, I ended up using this configuration:
In that way, I was able to connect from a remote machine using
http://192.168.1.50:53351
.在如此完整的主题上浪费了 3 个多小时后,我决定与您分享我的设置。
我的配置是 Windows 8 上的 Visual Express 2012 for Web update 4。这是我自学习以来(至少 8 年)第一次回到 MS VS,现在我确信 Linux 占主导地位。在 django 上,这种设置花了我 10 分钟的时间搜索文档。
关闭防火墙进行测试
在我的情况下设置绑定本地地址是 localIP=192.168.1.102 (因为链接不能包含非数字域,请在下面使用它而不是 mylocaldomain.com,请参阅 stackoverflow 策略)
在
Documents\IISExpress\config\applicationhost.config
<前><代码><绑定>
<绑定协议=“http”绑定信息=“*:53351:mylocaldomain.com”/>
<绑定协议=“http”绑定信息=“*:53351:localhost”/>
为ISS Express自动启动服务添加自动运行
向 http 服务器添加一些奇怪的规则(我仍然不知道这是否有必要)
手动运行IISExpress而不是从VS IDE
http://mylocaldomain.com:53351
如果它正常工作,那么我们可以添加防火墙规则
添加防火墙规则
集remoteip到any如果你想从外部世界访问你的服务器如果你想访问本地网络使用localsubnet
启动防火墙
再次检查本地和公共IP上的一切是否正常
祝你好运
Rafal
After wasting more than 3h on such a full subject I decided to share my setup with you.
My configuration is Visual Express 2012 for Web update 4 on windows 8. This was my first come back to MS VS since studies (at least 8 years) and now I'm sure that linux rules. On django this kind of setup took me 10min of searching documentation.
turn off firewall for testing
setup bindings in my case local address is localIP=192.168.1.102 (because links can not contain nonnumeric domain, use it below instead of mylocaldomain.com, see stackoverflow policy)
in
Documents\IISExpress\config\applicationhost.config
add autorun for ISS Express start service automatically
Add some weird rules to http server (I still do not know if this is nesseary)
run IISExpress manually not from VS IDE
http://mylocaldomain.com:53351
if it is working then we can add firewall rule
add firewall rule
set remoteip to any if you want to access you server from outside world if you want to access for local network use localsubnet
start firewall
check again if everything is working on local and public ip
Wish you luck
Rafal
发现问题与错误的 urlacl 映射有关。要弄清楚这一点:
并查找诸如
http://+:80/
或您绑定到的端口之类的内容。然后使用
这解决了我的问题。
Found the problem had to do with a bad urlacl mapping. To figure this out:
and look for things like
http://+:80/
or the port you are binding to.Then use
This fixed the problem for me.
没有什么对我有用。最后我找到了 iisexpress-proxy
查看我的答案https://stackoverflow.com/a/33623399/631527
另一个解决方案是
ngrok
Nothing worked for me. Finally I found iisexpress-proxy
See my answer https://stackoverflow.com/a/33623399/631527
Another solution is
ngrok
对我有帮助的是右键单击“IISExpress”图标,“显示所有应用程序”。然后选择该网站,我看到它使用哪个 aplicationhost.config,并且更正进行得非常完美。
What helped me, was right clicking the 'IISExpress' icon, 'Show All applications'. Then selecting the website and I saw which aplicationhost.config it uses, and the the correction went perfectly.
问题是更新 web 文件夹中的 applicationhost.config 文件而不是解决方案的文件。解决方案配置文件是要更改的文件
The problem is updating the applicationhost.config file inside the web folder instead of the solution's. The solution config file is the one to change
关于 Anthony Rizzolo 的回答:在 Windows 8.1 中,我必须这样输入:
例如:
Regarding Anthony Rizzolo's answer: in Windows 8.1, I had to type like this:
For example:
@vikomall 解决方案后,不要忘记以管理员身份启动 VS。
这帮我解决了。
After solution of @vikomall don't forget to start VS as adminisrator.
This fix it for me.
上面的答案都不适合我。
我在 netsh 中有两个条目用于同一服务
netsh http show urlacl
一个使用强通配符,另一个使用弱通配符。
删除通配符弱的那个就可以了。
有关 netsh 上下文中强通配符和弱通配符的更多信息
https://learn.microsoft.com/en-gb/ windows/desktop/Http/urlprefix-strings
None of the answers above worked for me.
I have had two entries in netsh for the same service
netsh http show urlacl
One using a strong wildcard, the other one using a weak wildcard.
Removing the one with the weak wildcard did the job.
More about the strong and weak wildcard in the context of netsh
https://learn.microsoft.com/en-gb/windows/desktop/Http/urlprefix-strings