I upgraded an application to Web Api 2 and the Application_Start would not fire post upgrade running on IIS Express. I did follow the official upgrade path at http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2 and have triple checked my settings.
The application uses StructureMap MVC 4 to inject dependencies. So WebActivator's PreApplicationStartMethod gets fired and the dependency resolver gets set correctly. After that, no other execution can be traced. I have enabled Edit and Continue and yet break point at the start of Application_Start is not hit.
Here's all that I've tried: a. Disable PreApplicationStartMethod and run the app b. Change the compile settings of the Global.asax and the code behind c. Create another WebApi2 project with similar structure and set up minus the actual code and that works fine
I have cleaned and run the app; also have cleaned the Temp ASP.NET folder
Appreciate the help towards resolving this issue.
Put a Debugger.Break();
statement in your Application_Start, and then do an iisreset
or recycle your app pool, then hit F5. A Just in time debugger window should appear if a breakpoint doesn't cut it.
Your debugger attaches after your application is started, therefor you won't hit any breakpoints in your application start method. A workaround is to cause your webserver to restart while you're attached to the process:
Simply edit your web.config (just add a space) and save it, this will make your http application restart.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With