I am getting an intermittent "System.Web.HttpException: Request timed out." error when my code hits the line response.write():
我得到一个间歇性的“System.Web.HttpException:请求超时。”我的代码命中行response.write()时出错:
sMessage = "Searching...0% complete."<br>
sSetVal = "<script>document.getElementById('MessageDiv').innerHTML='" & sMessage & "';</script>"<br>
Response.write(sSetVal)
Note that Response.BufferOutput = false is set when the page first starts executing (well before the above code executes).
请注意,当页面首次开始执行时(在执行上述代码之前),将设置Response.BufferOutput = false。
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.
该代码用于更新进度消息,而其他线程执行长时间运行的进程。一个线程连续运行并检查其他线程的状态。当其他线程完成时,该线程将更新的状态消息输出给最终用户。我意识到这可以(应该)使用ajax进行重新编码,但它是一个遗留应用程序,目前不是一个选项。
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
此代码每天运行10,000次以上,并且错误仅发生约5次 - 因此我怀疑当网站繁忙时,响应对象被其他线程阻止。但是,我不知道要在性能监视器中检查哪些性能计数器。或者这个问题是由别的东西引起的?我使用的是IIS 6,asp.net v2和vb.net
1 个解决方案
#1
Have you tried moving the Response.BufferOutput = false
to before the Response.Write
?
您是否尝试过将Response.BufferOutput = false移至Response.Write之前?
I would try monitoring the performance counters for memory usage and GC2 collections.
我会尝试监视内存使用和GC2集合的性能计数器。
#1
Have you tried moving the Response.BufferOutput = false
to before the Response.Write
?
您是否尝试过将Response.BufferOutput = false移至Response.Write之前?
I would try monitoring the performance counters for memory usage and GC2 collections.
我会尝试监视内存使用和GC2集合的性能计数器。