Why does app_offline.htm keep appearing in my web project?

Shaul Behr picture Shaul Behr · Jan 27, 2010 · Viewed 8.2k times · Source

I regularly (every few days or so) publish my ASP.NET web project to the local web server.

But the weirdest thing keeps happening... a file called "app_offline.htm" keeps appearing, unbidden, in my web project!

I have deleted this file several times, it is not in source control, and AFAIK nobody else is tampering with the project. But practically every time I try to publish the project, my publish fails (Unable to add 'app_offline.htm' to the Web site. The file 'app_offline.htm' already exists in this Web site.Error: The operation could not be completed. Unspecified error), I go back to look at the project, and there it is again, large as life, and I suspect if it could it would be blowing raspberries at me. :p

Having read up a little about this file, I gather it's meant to be an easy way to take your app offline. But I didn't see anywhere that it's supposed to impose itself on you arbitrarily for no good reason.

So, where is this *&^%$#@%!! file coming from, and why does VS think I need it?

Answer

Albert picture Albert · Jan 27, 2010

This is a .NET 2.0 "feature"

http://weblogs.asp.net/scottgu/archive/2005/10/06/426755.aspx

http://www.codeproject.com/KB/aspnet/app_offline.aspx

"The easiest way around this is to never publish directly to your server. You shouldn't anyway... Publish to a local folder then copy the site up"

Do you use Visual Studio? http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=102778