Search code examples
c#asp.netrestart

how to restart asp.net application besides modifying web.config


Is there a recommended way to bounce an asp.net application besides touching web.config from inside the application? is HttpRuntime.UnloadAppDomain(); the preferred way to do this ? and if so where do you do this? In the unload of a page or some other place in the application?


Solution

  • If this is .NET 2.0 or greater, then you can add in an "App_offline.htm" file, make a request to the server, remove it, and then make another request to the server.

    This sequence of events will force ASP.NET to unload the application for as long as the app_offline.htm file exists in the folder.

    Scott Guthrie's blog entry on it: http://weblogs.asp.net/scottgu/archive/2005/10/06/426755.aspx