App_offline.htm is getting generated on the server


This is one interesting situation I came across this week. We are trying to remote debug an ASP.Net 4.0 application using Visual Studio 2010. FREB was showing http 500 error for the DEBUG request.

We started looking at the memory dumps and found that something is not right. More than once, we see Application Domain being shut down. We noticed that it was due to App_offline.htm being present in the the application root. So no wonder why the application domain is shutting down. But we know that we didn’t put the file in there. We ran Process Monitor and it confirmed the presence of app_offline.htm right in the application directory. But we don't see the file there if we open it in Windows Explorer.

So where was it coming from?

Another interesting fact was that, we could browse the site if we run it without debugging (Ctrl + F5). So this raise the suspicion, somehow Visual Studio is responsible for it.

Using Process Monitor on the client we found that

The app_offline.htm file was there in the user’s Roaming Profile folder (C:\Users\ <User ID>\AppData\Roaming\Microsoft\VisualStudio\10.0\ ).

And that is how it was getting pushed on the server during debugging.

Devenv was deleting it once the debug attempt fails. So this is why we were able to access the site when running without debugging.

Deleted the file from client profile and no more mysterious appearances of app_offline.htm on the server.

To know more about App_offline feature, check Scott Gu’s blog -

Hope this helps.