Many Times we need to debug the Application_Start on server where we can not debug with Visual Studio IDE, instead we use CLR Debugger. So debugging on Global.asax.cs is deifficult as you need to attach the W3WP process, but it starts only when your application get a first hit, and so Application_Start code already executed. So how we can debug ??
So I was reading few discussion over mail thread when I came across this wonderful ideas.
(Hey Guys accept my thanks and from others as well [who read this ] for your good debugging tricks.)
So here we goes -
- Put delay in Application_Start Methods first Line as approx. you need to attach the debugger.
- #if DEBUG
if(ApplicationSetting("DebugStartup"))
System.Diagnostics.Debugger.Break();
#end if