ASP.Net 发布超时 [英] ASP.Net Post timeout

查看:29
本文介绍了ASP.Net 发布超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在过去 2 周遇到了 asp.net 发布问题.

I am stuck with asp.net post issue with last 2 weeks.

场景:

我的应用程序页面有 3 个控件.一个所见即所得的编辑器(自由文本框),一个文本框获取正在编辑的文章的名称,另一个文本框接受关键词.

My application page has 3 controls. A WYSIWYG editor (Free Textbox), a text box to get name of the article being edited in WYSIWYG editor, another text box to accept key words.

页面中控件从上到下的顺序如下,
一、名称文本框
二、所见即所得编辑器
最后,关键字文本框

Order of the controls in page from top to bottom as follows,
first, Name text box
second, WYSIWYG Editor
last, Key Word text box

问题:

当用户试图保存他们编辑过的文档时,IIS 服务器返回超时(生产在 win 2008 上运行).但有趣的是,名称文本"框信息和所见即所得编辑器的一半(不完全是一半,因情况而异)信息保存到数据库中.但最后一个关键字文本"框没有保存.在此 Web 服务器挂起一段时间后,将用户踢出并在几分钟后恢复正常速度.我认为应用程序池是回收的.但是在我的开发环境中一切正常(在我的 PC 上运行 Win 7 64 位).我还在生产和开发环境的页面指令中设置了 ValidateRequest="False".

When ever users tries to save their edited documents, IIS server returns time out (Production runs on win 2008). But interestingly, "Name text" box information and half of WYSIWYG Editor (its not exactly half, it varies for each case) information is saved to database. but last "keyword text" box is not saved. During this web server hangs for a while, kicks out the user and later after few mins back to normal speed. I think app pool is recycled. But all works fine on my development environment (in My PC runs on Win 7 64bit). Also i have set ValidateRequest="False" in page directive for Production and Development environment.

环境:

环境 .NET 4.0、ASP.NET
自由文本框所见即所得编辑器
共享主机 windows 2008
SQL Server 2008

Environment .NET 4.0, ASP.NET
FreeText box WYSIWYG editor
Shared Hosting windows 2008
SQL Server 2008

尝试过的解决方案(但没有突破):

尝试使用不同的浏览器 Firefox、chrome、IE 和相同的错误.
在页面指令中添加了 ValidateRequest="False" 并用纯文本框替换 WYSIWYG 编辑器并尝试保存,同样的问题.
只是尝试直接从 page.request 对象记录发布数据.仍在获取名称文本框"的完整数据,一半是所见即所得的文本框,其余的没有.
数据库连接或表字段没有问题.我已经三重检查了.

Tried with Different Browser Firefox, chrome, IE and same error.
Added ValidateRequest="False" in page directive and replaced WYSIWYG editor with plain text box and tried to save, same issue.
Just tried to log the post data directly from page.request object. Still getting full data for "Name textbox" half for WYSIWYG textbox and nothing for rest.
There is no issue on DB connection or table field. I have triple checked.

可能的怀疑和问题:

据我所知,发布数据长度没有限制.但在 IIS 中是否可以覆盖它?想知道这是否设置在我的共享主机上.
基本上,http 发布数据在浏览器和 server.request 对象之间的某处被截断.如果发生这种情况会是什么原因?
如果 http post 被截断,为什么整个应用程序挂起(或重新启动)?
将html内容发布为http post时需要采取哪些预防措施?

Based on my knowledge there is no limitation on post data length. but in IIS is it possible to override this ? wondering if this is set on my shared hosting.
Basically http post data gets truncated somewhere between browser and server.request object. What would be the reason if this is happening?
If http post is truncated why whole application hangs (or restarts)?
What are the precaution need to be taken when posting html content as http post?

谢谢.

新发现:

使用 httpfox 检查了我的帖子.帖子大小约为 9958 字节.但是 firefox 发送前 330 字节的数据,然后网页挂起.大约一分钟后,我在 httpfox 中收到 NS_ERROR_NET_RESET 错误代码.

Checked my post using httpfox. Post size was about 9958 bytes. But firefox sends first 330 bytes of data and then web page hangs. After about a minute, i am getting NS_ERROR_NET_RESET error code in httpfox.

使用带有 IE9 的 filder2 检查我的帖子.它尝试发送前 512 个字节然后挂起.返回ReadResponse() 失败:服务器没有为此请求返回响应."

Checked my post using filder2 with IE9. It tries to send first 512 bytes then hangs. Returns "ReadResponse() failed: The server did not return a response for this request."

问题:

这可能是浏览器问题或服务器问题.我认为如果浏览器问题,IE 和 Firefox 不会发生这种情况.

This likely would be browser issue or server issue. I think if browser issue, this wont happen for IE and Firefox.

更新:

很可能将问题与网络托管隔离开来.通过将表单发布 url 更改为不同的域进行测试,并查看是否可以在该域中检索值.是的,它有效.只是它不适用于我的域.有趣的是,我为普通的 html 页面帖子测试了这个.它也没有工作.所以很可能安装了安全措施以防止这种情况或服务器配置错误.已经把票给他们了,等着吧.

Most likely isolated the problem towards web hosting. Tested by changing form post url to different domain and see if values can be retrieved at that domain. Yes it works. Only it didn't work for my domain. Interestingly i tested this for normal html page post. it also didnt work. So most likely a security installed to prevent this or server misconfiguration. Already put a ticket to them and waiting.

您的所有反馈如何帮助我隔离问题.

Any how all of your feed back helped me to isolate the problem.

已解决:

是的,这个问题出在我们的网络托管网站上.到目前为止,我从他们那里听到的消息就像一些防火墙阻止了来自 http 的大帖子.他们说现在我们的域名被列入白名单.无论如何,现在它的作品.但这占用了我 2 周的时间,但这是很好的学习经验.谢谢大家帮助.真的很感激.

Yes this issue was on our web hosting site. So far i heard from them is like some firewall blocking the big post from http. They said now our domain is white listed. Anyway, now its works. But this ate 2 weeks of my time, but it was good learning experience. Thanks guys for your help. Really appreciated.

推荐答案

我在一个网页上遇到了同样的错误.它非常有线,因为如果我使用代理,错误就会发生,如果我直接从我的计算机上调用我有时间,并且永远不会继续.

I have face the same error on one web page. Its was very wired because if I was use proxy, the error go way, if I was called from my computer direct I have time out, and never go on.

直到 2011 年 12 月出现此问题的网站是 http://www.auctionsniper.com/如果我使用它的移动版本,同样的网站也能工作.

The site that this issue appear until now Dec/2011 is the http://www.auctionsniper.com/ The same site works if I go with the mobile version of it.

在对上述站点进行多次检查后,我发现问题出在非常大的视图状态!.我如何找到它:我保存页面的 html 部分,作为它的呈现,并开始从 html 中删除项目并制作帖子,直到我发现当我削减视图状态帖子时帖子还在继续.

After many checks with the above site I discover that the problem was with the very big viewstate !. How I find it: I save an html part of my page, as its rendered and start remove items from the html and make post, until I discover that the post continue when I cut down the viewstate post.

解决方案是在许多不需要的控件上禁用视图状态,并将剩余的视图状态发布数据压缩+剪切成更小的部分.

你可以谷歌搜索并找到很多方法来压缩和切割视图状态.

You can google and find many ways to compress and cut the view state in parts.

部分文章:

http://msdn.microsoft.com/en-us/magazine/cc188774.aspx

如何裁剪教程:
http://www.dotnetfunda.com/articles/article634-viewstate-patterns-in-aspnet-.aspx

如何压缩
http://www.hanselman.com/blog/ZippingCompressingViewStateInASPNET.aspx
http://www.codeproject.com/KB/viewstate/ViewStateCompression.aspx
http://www.google.com/search?hl=en&safe=off&q=asp.net+compress+viewstate&aq=f&aqi=g1g-b2&aql=f&oq=

附:在您使用的 这个免费 TextBox 的演示页面 中,视图状态是巨大的!它甚至没有文本,想象一下如果你真的有文本,视图状态会有多大.不是那么免费 - 成本是巨大的视图状态.

Ps: In this demo page of the free TextBox that you use, the viewstate is huge ! and its even empty from text, imagine how big the viewstate can be if you actual have and text inside. Not so free - the cost is the huge viewstate.

正如 Jeyara 在下面的评论中所说,最后这是错误,托管服务器上的防火墙阻止了大型帖子文件.

As Jeyara say on the comments below, final this was the error, a blocking of large post files by a firewall on the hosting server.

因此错误/超时与大量回发数据有关,这是一个罕见但存在的问题.

So the error / timeout have to do with large post back data and its a rare but existing issue.

这篇关于ASP.Net 发布超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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