Debugging Application_Start Event in Global.asax

by Johnny Nouel 8. abril 2011 14:52
Debugging is something we are always doing.  It never stops and developers love the tools given to find a bug when thing are not working as they should.  In this blog post the target for debugging is the Application_Start event in Global.asax for a Web Application in ASP.NET. You might have a routine that needs to setup some information at application startup so you make your call from within the event in question.  The problem is that the breakpoint you setup fires once and then it never fires again.  Bummer! The Application_Start event is fired only once per application start when the first page is requested.  It fires again if the server is stopped and restarted or when the application pool is recycled. The thing is that if you hit F5 to debug the application in Visual Studio you will hit the breakpoint the first time it runs but subsequent runs will not.  You can make the Application_Start event to run again by doing the following: Clean the build.  Then run the application.  As the DLLs get updated after the build the server restarts the application pool. Restart the server process.  If you're running the ASP.NET Development Server right click on the system try icon and select Stop.  Then run the application again. If you're running IIS Express you stop the process the same way.  Right click on its tray icon and Stop the application. Hope it helps!

Tags: , ,

Debugging

Recent Posts

Sobre mi

Johnny Nouel Mi nombre es Johnny Nouel. Profesional de Tecnología.  Experto en SAP FI CO.  Especialista en SAP BW, BI y BO.  Desarrollador ASP.NET.  Amante de los Videojuegos y la Tecnología.  Aguilucho!

Contactame?