ban*_*iya 2 asp.net ajax fluent-nhibernate sql-server-2008 asp.net-4.0
该网页是一个简单的注册类型页面.每个用户必须填写大约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:
**************************************************************************
Run Code Online (Sandbox Code Playgroud)
在日志中重复发现这些错误.
我试过增加数据库大小,但之后没有测试过.
我完全卡住了!请指导如何进行.
ban*_*iya 10
以下是我尝试的解决方案:
生成特定的机器密钥和aAdding enableViewstateMac ="False",如本文所述.本链接中提供了另一篇有用的文章
当页面内的控件数量很大时(我们有大约200个控件),maxpagestatefieldlength属性应设置为较小的值,该字段表示发送到客户端浏览器的视图状态被分成多个隐藏字段,每个字段的值小于MaxPageStateFieldLength属性中指定的大小.我们指定了maxpagestatefieldlength ="40"
我们已经完成了本文中指定的视图状态压缩.代码压缩视图状态,从而使网站在慢速互联网连接中也能正常工作!
以下是我们在web.config文件中添加的标签enableEventValidation ="false"viewStateEncryptionMode ="Never"enableViewStateMac ="false".请注意,出于安全原因,enableViewStateMac设置为true.MAC保证客户端不会恶意篡改ViewState的内容.(加密本身不足以保证这一点; MAC是必需的.)EnableViewStateMac属性将在产品的未来版本中删除,因为没有正当理由将其设置为"false".
我们在代码中做的另一个重要错误是我们使用应用程序变量在日志中存储错误详细信息并将其显示在错误页面中.由于使用了应用程序变量,当一个客户端发生错误时,应用程序将挂起剩余的客户端.我们删除了该应用程序变量并使用了不同的方法进行错误处理.我们使用的错误处理方法是从本文获得的
我们在测试期间面临一个问题.错误是"超出最大请求长度",这是通过实现本文中给出的建议来解决的
我们在我们的网站上使用了更新面板,其中添加了AJAX选项卡容器.现在我们删除了该更新面板,并在每个选项卡面板中放置了一个单独的更新面板.
"无效的Viewstate"错误的主要原因是当ViewState变得"大"并且用户在前一个请求完成之前单击按钮时抛出异常...在我们的情况下,这很容易发生,因为回发正在使用ajax,因此在将ViewState发送到服务器时,浏览器不会停止响应.单击此控件会一遍又一遍地导致异常.这个概念在本文中被解释, 但在该链接中没有得到适当的可行解决方案!
我们已经测试了50个并发用户的网站,并没有收到任何错误!希望这有助于面临此错误的所有人!
| 归档时间: |
|
| 查看次数: |
9687 次 |
| 最近记录: |