连接被重置ASP.NET [英] The connection was reset ASP.NET

查看:333
本文介绍了连接被重置ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些code,从SQL数据库提取数据,然后通过记录循环生成一个字符串,它最终将被写入到一个文本文件中。

I have some code that pulls data from SQL DB, then loops through the records to generate a string, which will eventually be written to a text file.

在code运行在我的本地精品,从VS,但现场的服务器上,后约一分半钟,我得到没有数据接收错误(铬)。在code停在通过DataTable中循环的中间。主机支持说,连接被重置的错误被抛出。

The code runs fine on my local, from VS, but on the live server, after about a minute and half, I get "No Data Received" error (chrome). The code stops in middle of looping through the DataTable. Hosting support said "The connection was reset" error was thrown.

我不能确定这是否是一个超时问题还是什么。我已经设置在我的web.config中的executionTimeout(含调试= FALSE),它似乎并没有帮助。我也查了Server.ScriptTimeout属性,它确实符合executionTimeout值在web.config设置。
此外,超时通常会给予页不可用的消息。

I"m not sure if this is a timeout issue or what. I've set the executionTimeout in my web.config (with debug = false) and it didn't seem to help. I also checked the Server.ScriptTimeout property, and it does match the executionTimeout value set in the web.config. Additionally, a timeout would normally give "Page not available" message.

任何建议都AP preciated。

Any suggestions are appreciated.

推荐答案

这听起来像它是一个的超时等待响应,而不是服务器上的浏览器。你无法控制的浏览器已经为这一点。你可以做的是发出某种浏览器的响应,这样它才能知道你还在周围,在某些方面还没有崩溃。

It sounds like it's the browser that's timing out waiting for a response, not on the server. You can't control what the browser has set for this. What you can do is send a response of some kind to the browser, so that it knows you're still around and haven't crashed in some way.

对于这个工作,你不能等到你完成构建整个字符串。你需要重新考虑你的code,这样,而不是附加到一个字符串,你写的每个除了输出流。这具有一种更有效的方式来建立你的文本文件中的额外的好处。为宗旨的浏览器还活着,你可以因为一些数据是回来为浏览器读出写任何东西,只要。 HTML注释可连续工作这一点。您还需要定期清理你的响应流,让你的数据不会坐在你的Web服务器上的缓冲。否则,你仍然可能会超时。

For this to work, you can't wait until you finish building the entire string. You need to re-think your code so that instead of appending to a string, you are writing each addition to an output stream. This has the added advantage of being a much more efficient way to create your text file. For purposes keeping the browser alive, you can write out anything, as long as some data is coming back for the browser to read. Html comments can work for this. You also need to periodically flush your response stream, so that your data isn't sitting buffered on your web server. Otherwise you might still timeout.

当然,真正的解决办法是重新考虑你的设计,使得您的操作并不需要90秒加在首位。但是,直到你能做到这一点,希望这是有帮助的。

Of course, the real solution here is to re-think your design, such that your operation doesn't take 90 seconds plus in the first place. But until you can do that, hopefully this is helpful.

这篇关于连接被重置ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆