5

Each time I start my ASP.Net MVC 3 app from Visual Studio 2010, IIS Express launches and IE spins waiting. The request fails with HTTP 503 Service Unavailable. I hit Refresh in IE, and the request succeeds. All subsequent requests succeed until I stop debugging. The next time I go to start debugging, the first request fails again.

Has anyone else experienced this?

In IISExpress\applicationhost.config I have:

<site name="ProjectName" id="6">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
            <virtualDirectory path="/" physicalPath="c:\users\chris\dropbox\code\2010\SolutionName\ProjectName" />
    </application>
    <bindings>
            <binding protocol="http" bindingInformation="*:80:laptop" />
    </bindings>
</site>

I have this in my hosts file:

127.0.0.1    laptop

And my Project is set to start with IIS Express, with Project Url set to:

http://laptop

It's very strange that only the first request fails, perhaps as though Visual Studio isn't waiting long enough for IIS Express to start? Is there some way to make it wait?

Stopping debugging, making a change, and then starting again is one of the most common tasks I do so adding another step to get there is pretty annoying.

Chris Moschini
  • 469
  • 1
  • 8
  • 16
  • This is not an Answer but I think this deserves follow-up: This did in fact turn out to be a problem with Visual Studio. Once 2 years passed and the next version came out, I upgraded, and this problem was resolved. – Chris Moschini Aug 30 '19 at 18:15

2 Answers2

13

IIS Express supports Failed Request Tracing and it's turned on by default. The logs are written to %IIS_USER_HOME%\TraceLogFiles which is usually at this location:

%USERPROFILE%\Documents\IISExpress\TraceLogFiles

In that folder you'll see a list of subfolders for each of the projects you've run up in IIS Express. In each site's folder there should be a bunch of frXXXXX.xml files and a freb.xsl file.

Using Firefox or Internet Explorer, open the frXXXXX.xml file(s) that has a time stamp closest to when you get these 503 errors. Once opened you'll see something like the following:

enter image description here

Hopefully you should discover the cause of the 503 error.

You could also try and start IIS Express for your project manually from the command line:

C:\Program Files (x86)\IIS Express>iisexpress /path:"[PATH]" /port:16444

Where [PATH] is the file system path to your project folder containing the site code, web.config etc, for example in your case it would be:

c:\users\chris\dropbox\code\2010\SolutionName\ProjectName

This might throw up some interesting errors if IIS Express can't start the site for the first time.

As an aside you can also tell Visual Studio to "Attach to Process" and start debugging that way.

Kev
  • 7,777
  • 17
  • 78
  • 108
4

The first and foremost action you need to take, is to determine what actually happens.

To do so, turn on Detailed Error Pages for local requests:

appcmd.exe set config -section:system.webServer/httpErrors -errorMode:DetailedLocalOnly /commit:apphost

Now all 400 and 500 class http returns will cause IIS to display a much more detailed error page.

Mathias R. Jessen
  • 24,907
  • 4
  • 62
  • 95