Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
270 views
in Technique[技术] by (71.8m points)

.net - ASP.Net Post timeout

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

Scenario:

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

Problem:

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.

Environment:

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

Tried solutions (but no breakthrough):

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.

Possible Suspicions and Questions:

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?

Thank you.

New Finding:

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.

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."

Question:

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

Update:

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.

Solved:

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

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.

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.

The solution was to disable viewstate on many non needed controls and compress+cut in smaller part the remaining viewstate post data.

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

Some articles:

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

how to cut it tutorial:
http://www.dotnetfunda.com/articles/article634-viewstate-patterns-in-aspnet-.aspx

how to compress it
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=

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.

Follow up

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...