IISExpress 一直拒绝来自自定义域的连接
IISExpress keeps refusing connections from custom domain
尝试了 Visual Studio 2015 年和 2017 年的最新更新、不同的 Web 应用程序(基于 .NET Framework 和 .NET Core)。 IISExpress 是 10.0,Windows 10 专业版。
当我 运行 像 http://localhost:49217, it works. If it's http://mydomain:49217 这样的网络应用程序时,我得到 "mydomain refused to connect"。同时,如果我做"ping mydomain",就成功了。
我做到了:
- "mydomain 127.0.0.1:" 在主机文件中
in applicationhost.config(同时替换 localhost 条目并保留 localhost 和 mydomain)
- 确保这是真实的 applicationhost.config(因为它们在不同的 Visual Studio 版本中有很多位置)。例如,当我直接在 Visual Studio 中更改设置时,我看到此文件已更新。
- "netsh http add urlacl url=http://mydomain:49217/ user=everyone" 在管理员权限下
我尝试以管理员身份 运行 Visual Studio 并直接 运行ning IISExpress(也以管理员身份):
C:\WINDOWS\system32>"c:\Program Files\IIS Express\iisexpress.exe" /config:"c:\solution_path\.vs\config\applicationhost.config" /site:"solution"
Starting IIS Express ...
Successfully registered URL "http://localhost:49217/" for site "solution" application "/"
Successfully registered URL "http://mydomain:49217/" for site "solution" application "/"
Successfully registered URL "http://*:49216/" for site "solution" application "/"
Registration completed for site "solution"
当它是 localhost 而不是 mydomain 时,我会看到传入连接。
我尝试关闭 Windows Defender Firewall for Private 和 Public 网络,但无济于事。
我还能做什么?
编辑:
我现在尝试 运行 Kestrel 下的一个 Web 应用程序(.NET Core 之一),这从一开始就有效,我可以很好地访问 http://mydomain:49217。只有 IISExpress 不起作用,我必须使用 IISExpress,Kestrel 不适合我。
您可以安装我们名为 Conveyor 的免费 VS 扩展(在工具 -> 扩展中)。它将打开一个新端口,接受来自其他主机名的连接。
例如。它将打开端口 45455,然后您可以转到 http://mydomain:45455
您将不再需要更改绑定,但您当然需要保留主机文件更改。如果您想使用我们的子域之一通过互联网访问,您也可以注册隧道。
尝试了 Visual Studio 2015 年和 2017 年的最新更新、不同的 Web 应用程序(基于 .NET Framework 和 .NET Core)。 IISExpress 是 10.0,Windows 10 专业版。
当我 运行 像 http://localhost:49217, it works. If it's http://mydomain:49217 这样的网络应用程序时,我得到 "mydomain refused to connect"。同时,如果我做"ping mydomain",就成功了。
我做到了:
- "mydomain 127.0.0.1:" 在主机文件中
in applicationhost.config(同时替换 localhost 条目并保留 localhost 和 mydomain) - 确保这是真实的 applicationhost.config(因为它们在不同的 Visual Studio 版本中有很多位置)。例如,当我直接在 Visual Studio 中更改设置时,我看到此文件已更新。
- "netsh http add urlacl url=http://mydomain:49217/ user=everyone" 在管理员权限下
我尝试以管理员身份 运行 Visual Studio 并直接 运行ning IISExpress(也以管理员身份):
C:\WINDOWS\system32>"c:\Program Files\IIS Express\iisexpress.exe" /config:"c:\solution_path\.vs\config\applicationhost.config" /site:"solution" Starting IIS Express ... Successfully registered URL "http://localhost:49217/" for site "solution" application "/" Successfully registered URL "http://mydomain:49217/" for site "solution" application "/" Successfully registered URL "http://*:49216/" for site "solution" application "/" Registration completed for site "solution"
当它是 localhost 而不是 mydomain 时,我会看到传入连接。
我尝试关闭 Windows Defender Firewall for Private 和 Public 网络,但无济于事。
我还能做什么?
编辑: 我现在尝试 运行 Kestrel 下的一个 Web 应用程序(.NET Core 之一),这从一开始就有效,我可以很好地访问 http://mydomain:49217。只有 IISExpress 不起作用,我必须使用 IISExpress,Kestrel 不适合我。
您可以安装我们名为 Conveyor 的免费 VS 扩展(在工具 -> 扩展中)。它将打开一个新端口,接受来自其他主机名的连接。
例如。它将打开端口 45455,然后您可以转到 http://mydomain:45455
您将不再需要更改绑定,但您当然需要保留主机文件更改。如果您想使用我们的子域之一通过互联网访问,您也可以注册隧道。