Visual Studio 2012 IIS Express 8 Fresh Install – Can’t Connect

iis-8iis-expressvisual studio 2012

On Visual Studio 2010 + IIS Express 7 I was able to use IIS Express as a server and browse sites.

I've since installed Visual Studio 2012 (on Windows 7 64-bit) with IIS Express 8, and I can't browse a single site on it. In addition, when I look at the log files (\Logs and \TraceLogFiles) I don't even see a single log entry for any of the 2012/IISExpress 8 apps, let alone an error to look into.

Looking at applicationhost.config, I do see the site I'm trying to run with the correct path, apppool and port.

But when attempting to run it, IIS Express 8 starts, I get an unusually long pause, and then I get a can't connect error in the browser. That is, in IE9 I get "Internet Explorer cannot display the webpage," in Chrome "Oops! Google Chrome could not connect to localhost:60046"

Has anyone else run into this? Is there something I need to do to complete the configuration of IIS Express 8 with VS2012?

UPDATE Mar 2 2013

This is still unresolved but here's a list of symptoms and partial solutions.

IIS Express completely non-functional
I was unable to connect to IIS Express under any conditions, originally. It turned out I had 2 problems, one relating to DNS, and the other appearing to relate to a bug in Visual Studio 2012.

Issue 1: Windows DNS
I had set my Windows wifi connection to use Google's DNS servers, rather than leaving it at Automatic. This worked fine with:

  • IIS
  • Cassini (Visual Studio internal webserver)
  • Nearly anything else

It did not work with:

  • IIS Express when attempting to connect to localhost – it fails to connect, even when running IIS Express from the command line, no Visual Studio involved.

The solution was to set my DNS settings back to Automatic (and switch my router to use Google DNS instead).

Issue 2: A bug in Visual Studio 2012 Microsoft is yet to acknowledge
This got me to a point where IIS Express works fine from command-line, and the only remaining issue is connecting to it from Visual Studio 2012. Cassini and IIS (not Express) from VS2012 work fine, including localhost and the same projects that fail in IIS Express.

When I attempt to run against IIS Express however, the IIS Express tray icon appears, a minute goes by where Visual Studio appears to freeze, and then the tray icon vanishes and the same error message as shown in this question appears in Visual Studio:

Debugging MVC application in VS2012 attempts to start IIS Express twice

One peculiar thing is that if I right-click that tray icon and attempt to open a browser against it during the minute freeze-up, I get the web application – it runs for that one minute and works as intended. Then it dies when Visual Studio apparently kills it.

I however can't confirm that IIS Express is running twice as in w.brian's issue. That said, this may be the exact same Visual Studio 2012 bug just showing very slightly different symptoms.

Microsoft bugs and paywall I've reported the issue to Microsoft. They began diagnosing it with me, but then told me I'd need to pay $250 to continue – something I'm not prepared to do to help them fix their bugs.

There are several bug reports on this:

My original bug report:
http://connect.microsoft.com/VisualStudio/feedback/details/766233/

A second one they had me open to navigate the bureaucracy:
http://connect.microsoft.com/VisualStudio/feedback/details/779161/

w.brian's bug report:
https://connect.microsoft.com/VisualStudio/feedback/details/778864/

But I suspect this is all the same bug that Microsoft is ignoring with a paywall between its customers and them, preventing them from actually gathering enough detail to recognize there's a bug here.

With Microsoft wasting enough of my time I've moved on to just using regular IIS as a workaround.

That's the absolute latest. Sorry everyone.

Update 8/2013: The machine that was experiencing this issue has since died (spilled something on it), and my new machine doesn't have this issue. I've suggested to Microsoft they reach out to others here with this issue. It may make sense to comment here if you're still experiencing the problem so they know how to contact you. And remember you can edit StackOverflow questions, so you can always just update this question yourself with more diagnosis information.

Best Answer

I tracked down the problem on my machine.

When I checked my C:\Windows\system32\drivers\etc\hosts file, I did not have

 127.0.0.1   localhost

in the file. I remember changing it "temporarily" to troubleshoot a problem. Adding back in the missing record fixed my problem.

You can test what IP your machine thinks localhost is by simply ping localhost and making sure that 127.0.0.1 is pinged and not some other IP.