Application_Start not firing? Ask Question

Application_Start not firing? Ask Question

I have an ASP.NET MVC (beta) application that I'm working on, and am having trouble figuring out if I'm doing something wrong, or if my Application_Start method in Global.asax.cs is in fact not firing when I try to debug the application.

I put a breakpoint on a line in my Application_Start method, and am expecting that when I attempt to debug the application that the breakpoint should get hit... but it never does. Not after I reset IIS, not after I reboot, not ever. Am I missing something? Why is this method never getting called?

ベストアンサー1

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 !

おすすめ記事