Application_Start not firing?

If this is in IIS, the app can get started before the debugger has attached. If so, I am not sure if you can thread sleep long enough to get attached.

In Visual Studio, you can attach the debugger to a process. You do this by clicking Debug >> Attach to process. Attach to the browser and then hit your application. To be safe, then restart IIS and hit the site. I am not 100% convinced this will solve the problem, but it will do much better than firing off a thread sleep in App_Start.

Another option is temporarily host in the built in web server until you finish debugging application start.


Note : a nice easy alternative to using the inbuilt "Visual Studio Development Server" or IIS Express (e.g. because you are developing against IIS and have particular settings you need for proper functioning of your app) is to simply stay running run in IIS (I use the Custom Web Server + hosts file entry + IIS binding to same domain)

  1. wait for debugging session to fire up ok
  2. then just make a whitespace edit to the root web.config and save the file
  3. refresh your page (Ctrl + F5)

Your breakpoint should be hit nicely, and you can continue to debug in your natural IIS habitat. Great !

Tags:

C#

Asp.Net Mvc