Rather than the productive day of web development I had planned I spent most of this morning trying to figure out why Visual Studio’s built in web server, webdev.webserver.exe, would not respond when I ran the web project.
At first I though it was the project so I checked the config, rebuilt it, and restarted Visual Studio – no luck.
Next I tried opening another project, that didn’t work either so I though it was something on my machine. Time to look at the anti-virus and firewall, but after disabling everything it still wasn’t working.
It was at this point I got a Skype message from one of my clients - “Do you know why the Development Web Server in Visual Studio might be broken?”. Ah ha! So it wasn’t just my machine. That must mean it was an update Microsoft pushed out.
Google didn’t have any likely looking results on the first couple of pages but a search of twitter returned a tweet from a developer in Prague (written in Czech) with the words Defender and webdev.webserver.exe in it. A quick pass through Google’s translation tool and I had the gist of the message: An update to Windows Defender has broken the mapping between localhost and the loopback address (127.0.0.1). All I had to do was run my project and replace localhost with 127.0.0.1 in the address bar and everything was fine.
I’ve wasted too much time on this as it is, so I’m going to stick with the workaround for now and I’ll update this post when I figure out the solution (unless you know the answer, in which case please post a comment!)
EDIT: Thanks to Dragan who dug a little deeper and found that it is the hosts file that is being modified. As he says in his comment, open C:\Windows\System32\drivers\etc\hosts and replace the ::1 next to localhost with 127.0.0.1