简体   繁体   中英

Sudden IIS application's shutdown

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!

The issue is finally solved after fixing all compilation warnings. I can't tell which one has fixed the issue, but thought to share my experience anyways. The warnings found was as for the below:

  1. Removing unused variables (about 10) (shouldn't affect)
  2. Duplicated namespace importing (about 10) (shouldn't affect)
  3. We had an outdated WCF service proxy. So we generated the new one (couple new methods were not added, and some changes on data types. However, this service is usually being called by some external extension that was out of our testing scope
  4. A warning related to a conflict in culture settings (AssemplyInfo.cs-> AssemblyCulture) between referenced projects (also not sure if this could affect, as when doing normal publish without merging pages & controls assemblies we don't have any issue)

Regards,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM