I have found that there are times in developing when I had to restart my ASP.NET application. One good application of this is troubleshooting application-level events, which is exactly what I needed to accomplish.

 

While browsing the digital library (Google), I found Peter Bromberg’s post, which handles the fundamental aspects of the task and simply modified it to fit the context of my environment and needs.

An ASP.NET application automatically restarts when one of the following occurs: the web.config file has been modified, a referenced class library has been modified, or when the HttpRuntime.UnloadAppDomain() method has been called. That call would look something like this:

 

System.Web.HttpRuntime.UnloadAppDomain();

 

After this following line executes, any subsequent page request to your application will fire the Application_Start() event and execute any code found in the method of the same name in the Global.asax file.

To be of any use for me, I needed the process to be completed automated and “on-demand” as Peter points out in his post, so it worked out well.

Comments


Comments are closed