该网页是一个简单的注册类型页面。每个用户必须填写大约 200 个字段。有 1 个父表和 6 个子表。每个表信息都显示在单独的 AJAX 选项卡面板中,详细信息保存在每个选项卡导航中。我在 Intranet 中托管了该网站,同时详细信息由 100 个用户输入。最初一切顺利,条目被保存在数据库中,但一段时间后显示 AJAX 加载图像,网站似乎很慢。用户的详细信息没有保存在数据库中。最后 Firefox 浏览器对某些人来说崩溃了,对某些人来说,应用程序甚至没有被注销。网站挂了!
我也重置了 IIS,一切都持续了几分钟,同样的问题又开始了!
我使用 NHibernate 框架、AJAX、ASP.Net 4.0 作为前端,使用 SQL Server 2008 作为后端。
以下是日志文件中的错误详细信息:
2014-08-11 10:05:40,953 [22] INFO ASP.global_asax servername : -
************************* 11/08/2014 10:05 **************************** IP Address: xx.x.xxx.xx Exception Type: System.Web.HttpException Exception: Request timed out. Source:
**************************************************************************
2014-08-11 10:05:40,984 [39] INFO ASP.global_asax servername : -
************************* 11/08/2014 10:05 ****************************`
IP Address: xx.x.xxx.xx
Exception Type: System.Web.HttpException
Exception: The client disconnected.
Source: System.Web
Stack Trace:
at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)
at System.Web.UI.ViewStateException.ThrowViewStateError(Exception inner, String persistedState)
at System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded()
at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument)
at System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument)
at System.Web.UI.WebControls.DropDownList.LoadPostData(String postDataKey, NameValueCollection postCollection)
at System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)
at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.ui_shape_profilereg_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
**************************************************************************
Inner Exception Type: System.Web.UI.ViewStateException
Inner Exception: Invalid viewstate.
Client IP: xx.x.xx.xx
Port: 44853
Referer: mypageurl.aspx
Path: /xx/xxxx/xxxxx.aspx
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20100101 Firefox/17.0
ViewState: /wEW4xwCvIuN0AIC1tvizQkCq67tpAgC76DRtAcCx+CW8AkCub6h1gwCgL6h1gwC2tGLOAKy2oaCCQLvkqjEDgKhnYMvArnixL8OApuuotUNAvL6+LQMAr6MpOoPArqKsKgDAvHcqZUKAqz10osPAu71uZENAqOa+OUDAtH844kHApLejoMIApLe0pAOAqze2pAOAqze0pAOAqu34bMNAtGFvd4JAq3e2pAOAq3e0pAOAtKFvd4JAqu3pa0NAtGF4dsJAsyRw5MHAsyRu9kFAqu35bMNAtGFod4JAsyRx5MHAsyRv9kFAof0kuQOApj0kuQOAoibuIoCAo/tyqYKAvnF+KIIAunaxagHAuu0gK8OAr+m5s0MAp3r6bkJAp/A0coMAs+s/tsNAseN/JQOApaT7OIDAr/1vroLArWhqYQMAqDH34kLArCo9ecHAsuo0fkHAtCo0fkHAqa0zecNApe1zIMOAofa5u0CApja5u0CApna5u0CApra5u0CApva5u0CApza5u0CAp3a5u0CAp7a5u0CApbxu6IGAoaekcwKApmekcwKApiekcwKApuekcwKApqekcwKAp2ekcwKApyekcwKAp+ekcwKAo6ekcwKAoGekcwKApme0c8KApme3c8KApme2c8KApme5c8KApme4c8KApme7c8KApme6c8KApme9c8KApmescwKApmevcwKApie0c8KApie3c8KApie2c8KApie5c8KApie4c8KApie7c8KApie6c8KApie9c8KApie...
Inner Source:
**************************************************************************
`2014-08-11 10:05:54,875 [82] INFO ASP.global_asax servername : -
************************* 11/08/2014 10:05 ****************************
IP Address: xx.x.xxx.xx
Exception Type: System.Web.HttpException
Exception: Request timed out.
Source:
**************************************************************************
这些错误在日志中反复出现。
我曾尝试增加数据库大小,但之后没有进行测试。
我完全卡住了!请指导如何进行。
最佳答案
以下是我尝试的解决方案:
enableEventValidation="false"viewStateEncryptionMode="Never"enableViewStateMac="false"。请注意,出于安全原因, enableViewStateMac 设置为 true。 MAC保证客户端不会恶意篡改ViewState的内容。 (加密本身不足以保证这一点;MAC 是必要的。)
EnableViewStateMac 属性将在产品的 future 版本中删除,因为没有正当理由将其设置为“false”。
我们已经用 50 个并发用户测试了该网站,没有出现任何错误!希望这对所有面临此错误的人有所帮助!
关于asp.net - asp.net 页面中的无效 View 状态错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25256408/