GRR: Trap Request Timed Out (80004005)

  • Thread starter Thread starter JP
  • Start date Start date
J

JP

I have a C# program that uses error handling via the Application_Error()
method in the global.asax file. The code in this method alerts me to any
unhandled exception in the program.

However, lately the program has been receiving "Request Timed Out" errors,
but it just shows the user the ugly old framework error screen rather then
processing the error, notifying me of the error, and display a beautiful
error screen to the user.

The problem turned out to be a slow SQL statement that took longer then the
httpRequest was willing to wait (I think). YES, I know you can change the
timeout setting for httpRequest inside the web.config. But the point is that
the code I have to process unhandled exceptions is not firing for THIS error.
Why and what to do to fix it so that it does process the error???
 
Hey Jp,

Did the error redirection work before? If so, did you for some reason change
the defaultRedirect setting of the customErrors web.config node

Or, do you have the ctx.Server.ClearError (); statement in the
Application_Error method?

Cheers,
Erjan
 
The Application_Error performs

Exception LastError = Server.GetLastError().GetBaseException();

The error objects gets passed to a custom DLL that store the error in a
database and send emails about the error to parties involved. It has a REF
string that contains the HTML error message to display to the user after it
returns from the DLL. Its not the DLL crashing. I can catch every error that
comes across but "Request Timed Out". Im thinking that it may be doing a
Thred.Abort() and the Application_Error never fires. This works for 10 other
apps, but this seems to be the only app throwing this particular error. Like
I said, if its throwing the error thats fine. I just want to know why I cant
capture it. Sample below

string ErrorResponse = ""; //variable to hold response from ReportError tool
string ErrorPage = null; //variable to hold friendly error page;

myUtility.Tools.ReportError NewError = new
myUtility.Tools.ReportError(LastError, ref ErrorPage, ref ErrorResponse);

Server.ClearError();
if (ErrorResponse == "")
{
if (ErrorPage != "")
{
Response.Write(ErrorPage);
}
else
{ Response.Write("Web error content not found");
}
}
else
{
Response.Write(ErrorResponse);
}
--
JP
..NET Software Developer


Erjan Gavalji said:
Hey Jp,

Did the error redirection work before? If so, did you for some reason change
the defaultRedirect setting of the customErrors web.config node

Or, do you have the ctx.Server.ClearError (); statement in the
Application_Error method?

Cheers,
Erjan
 
Hey JP,

I might hve overlooked something. Do you mean that you get the HTTP error
Request Timed Out?

This is not a .NET Framework exception, that's why it cannot be caught by
the error handling code in the Global.asax file. If you don't get another
error, it could be that for some reason the database request takes too much
time to execute. I would suggest you to try running the query in a separate
page in the same domain to check what happens. If it takes too long again,
you should inspect if the problem is in the Web Server <-> SQL Server
connection, or in the query/database structure.

Check this article out, it can be of help:
http://support.microsoft.com/kb/825739

Cheers,
Erjan

JP said:
The Application_Error performs

Exception LastError = Server.GetLastError().GetBaseException();

The error objects gets passed to a custom DLL that store the error in a
database and send emails about the error to parties involved. It has a REF
string that contains the HTML error message to display to the user after
it
returns from the DLL. Its not the DLL crashing. I can catch every error
that
comes across but "Request Timed Out". Im thinking that it may be doing a
Thred.Abort() and the Application_Error never fires. This works for 10
other
apps, but this seems to be the only app throwing this particular error.
Like
I said, if its throwing the error thats fine. I just want to know why I
cant
capture it. Sample below

string ErrorResponse = ""; //variable to hold response from ReportError
tool
string ErrorPage = null; //variable to hold friendly error page;

myUtility.Tools.ReportError NewError = new
myUtility.Tools.ReportError(LastError, ref ErrorPage, ref ErrorResponse);

Server.ClearError();
if (ErrorResponse == "")
{
if (ErrorPage != "")
{
Response.Write(ErrorPage);
}
else
{ Response.Write("Web error content not found");
}
}
else
{
Response.Write(ErrorResponse);
}
 
Back
Top