Application_Start not firing in ASP.NET MVC app

1.3k Views Asked by At

I've got an ASP.NET MVC app where the Application_Start event appears to not be firing. The symptoms are that an NLog log statement in that handler does not generate a log entry, and none of my routes get populated (so all my requests for controller actions return a 404).

Static files on the server (eg, favicon.ico) are served correctly.

I have log statements in Application_BeginRequest and Application_EndRequest. Those do generate log entries, both for the controller methods and the static files, so I feel pretty confident the app pool is configured correctly.

The problem shows up on our staging server, but not my local machine or our dev server.

Any idea what would cause this?

1

There are 1 best solutions below

1
joelt On

It ended up being a combination of things. The root cause was inconsistent versions of DLL's, and I solved that by configuring the project to copy the problem assemblies to my bin folder. On top of that, there was some code in Application_Error that was preventing the actual exception from being shown.