开发者

ASP.NET - why does database SP error crash application pool?

开发者 https://www.devze.com 2023-03-28 07:04 出处:网络
I have a ASP.NET 4.0 application which connects to MSSQL through WCF and then Stored Procedure layers.

I have a ASP.NET 4.0 application which connects to MSSQL through WCF and then Stored Procedure layers.

For some reason, with these layers, whenever I access a SP that is missing, or returns an error message, it causes my application to hang, because the application pool is stopped. Locally in debug mode, this causes by web server to crash.

Why does this happen? Is there a setting I can change to cause "better" behavior than a crash, or stoppage of the Application Pool?

UPDATE: I actually discovered that the app pool was stopping, not crashing. And it was stopping in IIS7/Windows Server 2008 R开发者_运维百科2 because it experienced too many errors in a short window. I adjusted the application pool setting to prevent it from stopping, and all works well. The errors were negligible.


The app pool wasn't actually crashing, but stopping.

This was the solution:

Turn off rapid fail protection for the app pool.

http://weblogs.asp.net/nannettethacker/archive/2009/01/08/windows-2008-and-iis7-application-pool-stopped.aspx


The only issues that I have see to crash the pools is to call him self and make a stackoverflow. So check your code if you have any call like that when there is an error.

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

Or maybe something like this that calling him self and crash.

protected override void OnLoad(EventArgs e)
{
  // call by mistake the OnInit and make close loop
  base.OnInit(e);
}

Eg, maybe when you have an error, the page you call, call again the same error page on a loop.


Its likley the IIS Health Monitoring has recycled the worker process because it failed to respond to a ping.

On my development machines I've disabled this. Under 'Advanced Settings' for the application pool, set 'Ping Enabled' = False under the 'Process Model' section.

0

精彩评论

暂无评论...
验证码 换一张
取 消