I have a multiple versions of an ASP.net website, all of them are working fine except the latest version which recently started to stop suddenly. Each version runs in a different application pool. Our investigations resulted in the following:
- Application_End event is getting fired after couple minutes from starting the web application. However, the Application_Start is not being triggered after that.
- After the application is stopped, most pages works with no styles, as our styles are bundled using "BundleTable". All bundles return 404 error, but the login process which relies on a web service works fine, and moves me to the home page (with no styles due to 404 response)
- Requesting any physical resource (image/js/css/svc) works fine
- After the Application_End event get fired, the w3wp process related to this application's pool remains running. Killing it with task manager makes no change. it will start again without causing the application_start to get fired
- Stop/restart/recycle IIS/pool doesn't cause the Application_Start to get fired (I'm checking using custom logging). Deleting asp temp files sometimes works but not everytime. Now I've tried everything but couldn't make it start again!
- List item
I'm using windows server 2012 64x, with IIS 8.5 and .net V4.5. Any hints are appreciated
Update-1: Here is a snapshot for the page with errors.
Update-2: After making few tests and adding more logs here and there, I can summarize the issue in a simpler way: First the issue shows only and only in the case I enable the "precompile during publishing" option while publishing my website, and merging all output DLLs in single assembly. After publishing with the above configuration, the Application_Start event will triggered on first page request, which is normal, and the main code I have in this event is to register all CSS & JS bundles, and configure URL routing. The application will work fine for approx. 30 minutes, then the Application_End will be triggered (with "HostingEnvironment initiated shutdown" shutdown reason) but the Application_Start won't be triggered again!. The Strange thing that the application will continue to serve subsequent requests (Ex: connect to database, do logging, authenticate users, serving WCF services requests...) but all bundles and URL routings that are registered in the Application_Start are lost. Another hint that general errors (Ex: 404) which are processed in the global.asax file are not getting processed after the Application_End is triggered! It seems like the application just ignore or forget to process this file again!