IIS Express does not start on localhost with ipv6

Hello to all Stackoverflow users!

Here is something funny that happened to me - maybe you can explain why?

Halfway through my work day, my IIS Express installation stopped working.

At first, I thought it was a problem with the ASP.NET project that I was working on, it just hangs and does not start, because the page continued to freeze until it ended. Then I tried some other projects also configured to run on localhost: 8080 - and they won’t load - even simple HTML versions.

Now that I say that they will not load; I mean no activity at all. The page will "load" in chrome for ages, and the IISExpress console will not register any GET requests until, finally, the tab in chrome displays a timeout error.

This morning I (with some help) understood something - for some reason, when I pinged localhost , the ipv6 ::1: address will return instead of the ipv4 address 127.0.0.1 - I have not noticed this behavior before, and I have not changed any network settings.

I edited my HOST file and included the entry for 127.0.0.1 localhost to force ping localhost to return the ipv4 address. This worked, and when I tried IIS Express to bind to localhost: 8080 again, it also worked.

My question is: What on Earth?!?!

I have no idea why this happened. I know that I was able to fix a single issue by editing my HOST file, but does anyone know why this could happen?

Any idea why ping localhost will suddenly start returning an ipv6 address? And any idea why IIS Express will not work with ipv6? (I assume that the IIS engine will have what is currently baked).

I would like to understand what happened in order to avoid any further problems and for the sake of rarity.

Thanks in advance for any information,

Phil

+4
source share
2 answers
  • Open the cmd admin window, then run it using the port you are attached to: netsh http add urlacl url="http://[::1]:8080/" user=everyone . This tells your system that it is tied to ::1
  • Open %USERPROFILE%\Documents\IISExpress\config\applicationhost.config , find the section of your site and add the IPv6 binding: <binding protocol="http" bindingInformation="[::1]:8080:*" />

Example:

<site name="WebSite1" id="2"> <application path="/" applicationPool="Clr4IntegratedAppPool"> <virtualDirectory path="/" physicalPath="C:\Users\ryan.versaw\Documents\WebSite1" /> </application> <bindings> <binding protocol="http" bindingInformation="*:8080:localhost" /> <binding protocol="http" bindingInformation="[::1]:8080:*" /> </bindings> </site>

+3
source

As long as IPv6 is enabled on your system, :: 1 and 127.0.0.0 are valid addresses for "localhost". Which of the two is returned by the system and is used for, for example, pings is more or less non-deterministic if the program does not specifically request an IPv4 or IPv6 address, and since Windows ping can handle either, it probably didn’t.

As for IIS, answers like this suggest that this behavior is targeted, and you need to enable binding to the IPv6 address separately: https://serverfault.com/questions/123796/get-iis-7-5-to-listen -on-ipv6

0
source

All Articles