Your official information source from the .NET Web Development and Tools group at Microsoft.
When you add a global.asax file to your "Web Application Projects (WAPs) like below:
and then write code in Application_Start event and try to debug it like below using Visual Studio inbuilt Development Web Server
Then during your first debug the breakpoint is hit but during your subsequent debug runs the breakpoint is not hit.
The reason behind this is that we do not kill the ASP.Net Web Server process after your every debug run and hence Application_Start() is not fired every time. There is a good reason why we do so... Starting ASP.Net Web Server process is an expensive task and in most of the scenarios recycling this process after every debug would adversely impact your performance... If you do not want to debug your Application_Start() method then probably you do not need to have the process restart and save performance most of the time...
However if you would like to have the breakpoint hit you have few easy workarounds... One of the workaround is that you stop the web server from your system tray as in the figure below:
Alternatively you can go to your property pages of your web application and enable Edit & Continue like shown below:
When you choose Edit and Continue then we recycle the ASP.Net Web Server process on every debug run (it is needed for the Edit & Continue functionality to work)... This way although you will see very marginal degrade in your performance you will still be able to debug your Application_Start() methods...
Hope this helps...
- Vishal R. Joshi | Program Manager | Visual Web Developer Team
A nice tip by Vishal R. Joshi (Program Manager | Visual Web Developer Team) about how to debug Global
An easy way is to change the web.config then try to access your web site, this will trigger application restart and call Application_Start().