【发布时间】:2019-10-16 04:40:27
【问题描述】:
尝试了 Visual Studio 2015 和 2017 的最新更新、不同的 Web 应用程序(基于 .NET Framework 和 .NET Core)。 IISExpress 是 10.0,Windows 10 专业版。
当我运行像http://localhost:49217 这样的网络应用程序时,它可以工作。如果是http://mydomain:49217,我会收到“我的域拒绝连接”。同时,如果我“ping mydomain”,就成功了。
我做到了:
- hosts 文件中的“mydomain 127.0.0.1:”
-
在 applicationhost.config 中(替换 localhost 条目并同时保留 localhost 和 mydomain) - 确保这是实际的 applicationhost.config(因为它们在不同的 Visual Studio 版本中有很多位置)。例如,当我直接在 Visual Studio 中更改设置时,我看到此文件已更新。
- “netsh http add urlacl url=http://mydomain:49217/user=everyone”在管理员权限下
我尝试以管理员身份运行 Visual Studio 并直接运行 IISExpress(也以管理员身份):
C:\WINDOWS\system32>"c:\Program Files\IIS Express\iisexpress.exe" /config:"c:\solution_path\.vs\config\applicationhost.config" /site:"solution" 启动 IIS Express ... 成功为站点“解决方案”应用程序“/”注册 URL“http://localhost:49217/” 为站点“解决方案”应用程序“/”成功注册 URL“http://mydomain:49217/” 成功为站点“解决方案”应用程序“/”注册 URL“http://*:49216/” 已完成网站“解决方案”的注册然后,当它是 localhost 而不是 mydomain 时,我会看到传入的连接。
我尝试关闭专用和公共网络的 Windows Defender 防火墙,但无济于事。
我还能做什么?
编辑: 我现在尝试在 Kestrel 下运行其中一个 Web 应用程序(.NET Core 之一),这从一开始就有效,我可以访问 http://mydomain:49217 就好了。只有 IISExpress 不起作用,我必须使用 IISExpress,Kestrel 不适合我。
【问题讨论】: