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.
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: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 afreb.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: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:
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: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.
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:
Now all 400 and 500 class http returns will cause IIS to display a much more detailed error page.