我们有3个服务器设置..其中两个有几乎相同的IIS配置和一个服务器这是设置略有不同。
所有3台服务器都运行相同的应用程序,但在两个副本上,当一个人休眠他们的PC并重新尝试登录(比如20分钟后)时,会出现ViewState错误。
这种情况只发生在2/3的服务器上。我已经比较了所有三个服务器的配置,并且正在努力寻找视图状态错误背后的原因。
在两个副本(未群集,仅运行两个单独应用程序示例的副本配置)服务器上,用户将其PC休眠并尝试在返回时刷新页面后生成以下错误:
********** 18/11/2014 22:01:40 **********
Inner Exception Type: System.Web.UI.ViewStateException
Inner Exception: Invalid viewstate.
Client IP: HIDDEN
Port: 61727
Referer: HIDDEN
Path: /WERWER/Loginpage.aspx
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
ViewState: /wEPDwUJMTU3NDQ3OTA5D2QWAgIDD2QWBgIFDxYCHgRUZXh0BQczLjEuNC4zZAIJDxAPFgIeC18hRGF0YUJvdW5kZ2QPFgICAQICFgIQBQtBc3RyYVplbmVjYQUBMWcQBQtBc3RyYVplbmVjcQUBMmdkZAILDw9kDxAWAWYWARYCHg5QYXJhbWV0ZXJWYWx1ZWQWAQIDZGRkfcrsQ9t3t1viPYtGtlL9zhltvqca0XJ8+sAMNb9FJhc=
Inner Source:
Exception Type: System.Web.HttpException
Exception: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
See http://go.microsoft.com/fwlink/?LinkID=314055 for more information.
Source: Application_Error - Global.asax
Stack Trace:
at System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose)
at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter2 formatter, String serializedState, Purpose purpose)
at System.Web.UI.HiddenFieldPageStatePersister.Load()
at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
at System.Web.UI.Page.LoadAllState()
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.ProcessRequest(HttpContext context)
at ASP._aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\appdir\405a4e54\e0bdc3da\App_Web_qp5t5y2q.3.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Another Occasion::
********** 16/10/2014 11:29:06 **********
Inner Exception Type: System.Web.UI.ViewStateException
Inner Exception: Invalid viewstate.
Client IP: hidden
Port: 63887
Referer: hidden
Path: HIDDEN
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
ViewState: /+kH3Hw9hzBkL2Oug==
Inner Source:
Exception Type: System.Web.HttpException
Exception: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
See http://go.microsoft.com/fwlink/?LinkID=314055 for more information.
Source: Application_Error - Global.asax
Stack Trace:
at System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose)
at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter2 formatter, String serializedState, Purpose purpose)
at System.Web.UI.HiddenFieldPageStatePersister.Load()
at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
at System.Web.UI.Page.LoadAllState()
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.ProcessRequest(HttpContext context)
at ASP._aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\\405a4e54\e0bdc3da\App_Web_uhtljwwn.1.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
有人能帮忙吗?
- 仅供参考:以下是最终用户对情况的描述:**
"好的-我检查了服务器,并在登录页面打开浏览器窗口的情况下休眠了我的PC。
30分钟后重新启动计算机,重新登录并得到我在其他副本服务器上看到的异常消息...
与我一起工作的人指出,我可以通过设置固定的机器密钥来解决这个问题-我应该将哪个机器密钥设置为"固定"?似乎有三个级别(可以从顶级IIS结构设置的机器密钥,可以从网站级别设置的密钥,以及可以从虚拟站点级别设置的密钥??)
我应该更改哪个密钥?为什么需要3个单独的"机器密钥"配置?
非常感谢!
2条答案
按热度按时间ffdz8vbo1#
只要改变你的选择。但要确保在所有的服务器应用程序看到相同的machineKey。
有多个级别的配置,因此您可以对其进行设置
cetgtptt2#
好的......这里有一个更新,如果可能的话,我真的很感激你的回复。
**问题:**空闲20分钟后,当用户尝试重新登录时,出现ViewState错误。
**初步了解:**在“Webadmin”身份下重新启动应用程序池时,未读取某些内容
**摘自Microsoft支持线程:**当应用程序池在用户帐户下运行时,不会生成上述键,从而导致间歇性无效视图状态错误。
**解决方案:**在web.conf中指定手动计算机密钥,此操作修复了此问题。
**预期结果:**为了能够理解为什么当应用程序池以用户身份运行时,在“计算机密钥”配置中为每个应用程序选项使用AutoGenerate / Unique时会出现视图状态错误。
1)在web.conf中指定静态密钥是否会涉及安全风险
2)为什么在不同用户下运行应用程序池时无法生成计算机密钥。
3)为什么以DefaultAppPool用户身份运行时不会出现此问题?