如何使应用程序池崩溃?

wil*_*lem 15 asp.net application-pool

我们的ASP.NET 2 Web应用程序非常优雅地处理异常.我们在Application_Error中捕获Global ASAX中的异常.从那里我们记录异常并向用户显示友好消息.

但是,今天早上我们部署了最新版本的网站.它运行了半个小时,但随后App Pool崩溃了.在我们恢复之前的版本之前,该网站没有恢复.

如何使应用程序池崩溃并跳过正常的异常处理程序?我试图复制这个问题,但到目前为止没有运气.


更新:我们找到了解决方案.我们的一个页面是屏幕抓图另一页.但URL配置不正确,页面最终屏幕自动无限,从而导致堆栈溢出异常.

Ari*_*tos 13

我看到的最常见错误和"池崩溃"是循环调用.

public string sMyText
{
   get {return sMyText;}
   set {sMyText = value;}
} 
Run Code Online (Sandbox Code Playgroud)

只需拨打sMyText即可...


Rob*_*ine 11

为了做到这一点,你需要做的就是从请求的上下文之外抛出任何异常(当然不处理它).

例如,在另一个线程上引发的一些异常应该这样做:

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);
}
Run Code Online (Sandbox Code Playgroud)

可以在MS知识库中找到更多信息