Search code examples
asp.netvisual-studioiis-express

IISExpress Custom Domains


I've been (successfully) running a couple of ASP.NET (.NET Framework 4.6.2, WebForms) websites through Visual Studio 2017 / IISExpress using custom domains. I installed Visual Studio 2019 (Community) the other day, and all of a sudden the custom domains have stopped working on all projects in both Visual Studio 2017 and 2019! The system-tray for IIS Express still continues to show that the binding is accepted:

enter image description here

However, when attempting to browse to that URL, Chrome gives me a "ERR_CONNECTION_REFUSED" error:

enter image description here

Just to be clear, the steps are taken on each project are as follows:

  1. Modify the applicationhost.config file in the web project's .vs folder to include:

<binding protocol="http" bindingInformation="*:80:agentdesktop.local" />

  1. In an elevated command prompt, execute:

netsh http add urlacl url=http://agentdesktop.local:80/ user=everyone

  1. Add to the hosts file:

127.0.0.1 agentdesktop.local

I've deleted the .vs directory, removed the urlacl entry, removed the IISExpress directory in the Documents folder. Performed all actions outlined above as had been done previously, and still I cannot get it to accept the connection!

If I ping agentdesktop.local then I get a valid response from 127.0.0.1, and the fact it's appearing in the IIS Express system tray, makes me think that something in between is intercepting and blocking.

Does anybody else have any ideas as to how I could get this back working again, or what might have gone wrong!?


Solution

  • I did some more digging, and found that running

    netsh http show iplisten

    Had a single entry of ::1. I removed this using:

    netsh http delete iplisten address=::1

    and everything started working again. Not quite sure what happened, but glad I found it.