views:

606

answers:

1

I am getting an intermittent "System.Web.HttpException: Request timed out." error when my code hits the line response.write():

sMessage = "Searching...0% complete."<br>
sSetVal = "&lt;script>document.getElementById('MessageDiv').innerHTML='" & sMessage & "';&lt;/script>"<br>
Response.write(sSetVal)

Note that Response.BufferOutput = false is set when the page first starts executing (well before the above code executes).

The code is used to update a progress message while other threads execute long-running processes. One thread runs continuously and checks the status of the other threads. As the other threads finish, this thread outputs updated status messages to the end user. I realise that this could (should) be recoded using ajax, but it is a legacy app and that is not an option at the moment.

This code is run 10,000+ times a day, and the error only occurs about 5 times - so I suspect the response object is being blocked by other threads when the website gets busy. However, I don't know which performance counters to check in the performance monitor. Or is this problem caused by something else? I am using IIS 6, asp.net v2 and vb.net

A: 

Have you tried moving the Response.BufferOutput = false to before the Response.Write ?

I would try monitoring the performance counters for memory usage and GC2 collections.

Mitch Wheat
The statment <b>Response.BufferOutput = false</b> was just to show what the status of the value was - it is set right at the start of the execution. I have also tried Response.BufferOutput = true, then it times out on the next <b>Response.Flush()</b> statement.
suggest you move it to start of code example...
Mitch Wheat
OK, I have moved the Response.BufferOutput = false to make it clearer.