0
votes

Tried both Visual Studio 2015 and 2017 with the latest updates, different web apps (.NET Framework and .NET Core based). IISExpress is 10.0, Windows 10 Pro.

When I run a web app like http://localhost:49217, it works. If it's http://mydomain:49217, I get "mydomain refused to connect". At the same time, if I do "ping mydomain", it's successful.

I did:

  • "mydomain 127.0.0.1:" in hosts file
  • <binding protocol="http" bindingInformation="*:49217:mydomain" /> in applicationhost.config (both replacing localhost entry and keeping both localhost and mydomain)
  • made sure that this is the actual applicationhost.config (as there are many locations of them in different Visual Studio versions). For instance, when I change settings directly in Visual Studio, I see that this file gets updated.
  • "netsh http add urlacl url=http://mydomain:49217/ user=everyone" under Admin privileges

I tried to run Visual Studio as Admin and also running IISExpress directly (also as Admin):

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"

I then see incoming connections when it's localhost but not mydomain.

I tried to turn off Windows Defender Firewall for Private and Public networks, to no avail.

What else can I do?

EDIT: I now tried to run one of web apps (.NET Core one) under Kestrel and this worked from the start, I can access http://mydomain:49217 just fine. It's only IISExpress which isn't working, and I have to to use IISExpress, Kestrel is not an option for me.

1

1 Answers

1
votes

You could install our free VS extension called Conveyor (in Tools->Extensions). It will open a new port that will accept connections from other host names.

Eg. it will open port 45455, then you can go to http://mydomain:45455

You won't need the binding changes anymore, but you will need to keep the hosts file change of course. Also you can signup for tunneling if you want to use one of our subdomains to access over the internet.