How do I crash the App Pool?

Our ASP.NET 2 web application handles exceptions very elegantly. We catch exceptions in Global ASAX in Application_Error. From there we log the exception and we show a friendly message to the user.

However, this morning we deployed the latest version of our site. It ran ok for half an hour, but then the App Pool crashed. The site did not come back up until we restored the previous release.

How can I make the app pool crash and skip the normal exception handler? I’m trying to replicate this problem, but with no luck so far.

Update: we found the solution. One of our pages was screenscraping another page. But the URL was configured incorrectly and the page ended up screenscraping itself infinitely, thus causing a stack overflow exception.


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

The most common error that I have see and “pool crash” is the loop call.

public string sMyText
   get {return sMyText;}
   set {sMyText = value;}

Just call the sMyText…

Method 2

In order to do this, all you need to do is throw any exception (without handling it of course) from outside the context of a request.

For instance, some exception raised on another thread should do it:

protected void Page_Load(object sender, EventArgs e)
   // Create a thread to throw an exception
   var thread = new Thread(() => { throw new ArgumentException(); });

   // Start the thread to throw the exception

   // Wait a short while to give the thread time to start and throw

More information can be found here in the MS Knowledge Base

Method 3

Aristos’ answer is good. I’ve also seen it done with a stupid override in the Page life cycle too when someone change the overriden method from OnInit to OnLoad without changing the base call so it recursed round in cirlces through the life cycle: i.e.

protected override void OnLoad(EventArgs e)
  //some other most likely rubbish code

Method 4

You could try throwing a ThreadAbortException.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x