Tuesday, April 6, 2010

App_Offline.htm

Phheeewwwww,

Back after a looong time. Its all been busy so long and was not able to post here something for long.
Now.... I have something to post + I have the time. So here we go....
Learnt a new concept today - App_Offline.htm.

There is a simple way to bring down your ASP.NET 2.0 application. The only thing you have to do is to create simple html file called App_offline.htm and deploy it to your ASP.NET 2.0 web application root directory. The rest is handled by ASP.NET runtime internal routines

This approach is extremely helpful for scenarios where we need to bring down the application instantly for some quick updates or any other purpose.

It stops processing new incomming requests and serves the contents of this App_offline.htm file.

Since the whole application domain is unloaded, all application files and assemblies are unlocked and we can make any necessary changes. When done with the changes, all we need to do is rename or delete App_offline.htm file and the next incoming request will bring the ASP.NET 2.0 web application back online.

There is also one great use of this. In order to unlock any attached Database files. This way, they are released and unlocked to be copied over anywhere.


Hope this helps someone, somehow.