Server Error 0x800004005 Request timed out.


I wrote this post and this lab about the impact of having debug=true in your web.config file.  The fact is, when you are running in a production environment, you do not want to have debug=true.  However, I was writing a series of NETSH tracing posts:

and I needed to have a request run, without timing out so that all my scenarios completed and those took longer than the default request timeout, therefore I got the Request timed out YSOD seen in Figure 1 because I deployed it correctly without debug=true.  Note that I had deployed my code to an IIS server and was not testing from within Visual Studio or IIS Express.

image

Figure 1, request timed out, 0x800004005

Server Error in '/' Application.
Request timed out. 
  Description: An unhandled exception occurred during the execution of the current web request. 
   Please review the stack trace for more information about the error and where it originated 
   in the code. Exception Details: System.Web.HttpException: Request timed out.
Source Error: 
An unhandled exception was generated during the execution of the current web request. Information
  regarding the origin and location of the exception can be identified using the exception 
  stack trace below.  
Stack Trace: 
[HttpException (0x80004005): Request timed out.]
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2053.0 

So, I set debug=true in my web.config which overrides the request timed out setting.  Don’t do this in production because you would create many other problems.  It does make sense that while in debug mode the timeout is disabled because when your code execution hits a breakpoint the timeout should not get triggered…

I am testing from a client, which is calling an ASP.NET Web Forms application executing this code, for example:

using (TcpClient client = new TcpClient())
{
  try
  {
    client.Connect("###.###.###.###", 80); 
    var status = "Did the client connect? {client.Connected.ToString()}";
    client.Close();
    var statusLabel = labelStatus.Text;
  }
  catch (Exception ex)
  {
    labelStatus.Text += "<br /><br />{System.DateTime.Now.ToString()} - " + 
         $"This is iteration number: {i.ToString()} there was an " + 
         $"exception: {ex.Message.ToString()}";
  }
}
...
using (HttpClient client = new HttpClient())
{
    Task.Run(() => RequestDataFailHttps(i).Wait());
}
...
using (var client = new HttpClient())
{
  try
  {
     var result = await client.GetStringAsync("https://***brokenlink***.com");
  }
  catch(Exception ex)
  {
     labelStatus.Text += $"<br /><br />{System.DateTime.Now.ToString()} - " +
       $"This is iteration number: {i.ToString()} " +
       $"with an exception of: {ex.Message.ToString()}";
  }
}

The result is displayed to the page, Figure 2 and logged in my NETSH trace.

image

Figure 2, request timed out, 0x800004005

Comments (0)

Skip to main content