How do I crash the App Pool?

爱⌒轻易说出口 提交于 2019-11-26 13:51:45

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...

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
   thread.Start();

   // Wait a short while to give the thread time to start and throw
   Thread.Sleep(50);
}

More information can be found here in the MS Knowledge Base

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
  base.OnInit(e);
}

You could try throwing a ThreadAbortException.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!