Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
Share on:

IIS Crashing unexpectedly in the .Net Framework

Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

Lately, I encountered an issue where IIS kept crashing every minute due to unhandled exceptions. There was nothing much in application logs except event viewer, which says application pool “xyz” terminated unexpectedly.

This was happening in IIS 6 with .Net 4.

Are you experiencing similar issue?

The reason IIS keep crashing caused by unhandled exception is because the default policy for an unhandled exception has changed in the .Net framework 2.0 and later version.

The behavior of this policy is to end the worker process.

Possible fixes

To fix this permanently, a developer must handle all exceptions in the application.

As a workaround, you can change unhandled exception policy back to legacy (.Net framework 1.x)   

  • Login into problematic IIS server
  • Find which version of .Net you are using
  • Go to below folder
  • Take a backup of Aspnet.config file
  • Modify or add if doesn’t exist following
<legacyUnhandledExceptionPolicy enabled="true" />     
  • Restart IIS Application pool

You will notice, IIS will prevent crashing, and you are back in business.

If you want to be master in IIS administration, then check out this course by Hassan Aboul Hassan.

Thanks to our Sponsors
More great readings on Development
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • Semrush is an all-in-one digital marketing solution with more than 50 tools in SEO, social media, and content marketing.
    Try Semrush
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder