Validation of viewstate MAC failed. 解决方法

  专注于web技术,但是不要沉湎于其中,开心就好!
  
  
  
  
  
  
  
  
  
  
  
  
  前段时间公司为了减轻服务器压力,对网页做了集群,分布在多台服务器,通过DNS轮回解析到各台服务器,结果页面只要打开停留到DNS解析到下一个地址,就会出现出下错误信息。
  Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
  Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
  Source Error:
  The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
  1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
  
  or:
  2) Add the following section to the configuration file of your application:
  
  
  
  
  
  Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
  Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.
  Stack Trace:
  [HttpException (0x80004005): Unable to validate data.]
  System.Web.Configuration.MachineKeySection.GetDeco dedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +294
  System.Web.UI.ObjectStateFormatter.Deserialize(Str ing inputString) +203
  [ViewStateException: Invalid viewstate.
  Client IP: 218.28.26.86
  Port: 45262
  User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; FDM)
  ViewState: /wEPDwUKLTQzMDM1NDM2MA9kFgRmDxYCHgRUZXh0BdEbdmFyIH NBcnIgPSBuZXcgQXJyYXkoKTtzQXJyWzE1XT1uZXcgQXJyYXkoK TtzQXJyWzE1XVswXT0xO3NBcnJbMTVdWzFdPWZhbHNlO3NBcnJb MTVdWzNdPTA7c0FyclsxNV1bMl09dHJ1ZTtzQXJyWzM4XT1uZXc gQXJyYXkoKTtzQXJyWzM4XVswXT0wO3NBcnJbMzhdWzFdPXRydW U7c0FyclszOF1bM109MTtzQXJyWzM4XVsyXT10cnVlO3NBcnJbN 109bmV3IEFycmF5KCk7c0Fycls3XVswXT0yO3NBcnJbN11bMV09 ZmFsc2U7c0Fycls3XVszXT0wO3NBcnJbN11bMl09dHJ1ZTtzQXJ yWzZdPW5ldyBBcnJheSgpO3NBcnJbNl1bMF09MDtzQXJyWzZdWz FdPWZhbHNlO3NBcnJbNl1bM109MTtzQXJyWzZdWzJdPXRydWU7c 0FyclszN109bmV3IEFycmF5KCk7c0FyclszN11bMF09MDtzQXJy WzM3XVsxXT10cnVlO3NBcnJbMzddWzNdPTE7c0FyclszN11bMl0 9dHJ1ZTtzQXJyWzEzXT1uZXcgQXJyYXkoKTtzQXJyWzEzXVswXT 00O3NBcnJbMTNdWzFdPWZhbHNlO3NBcnJbMTNdWzNdPTA7c0Fyc lsxM11bMl09dHJ1ZTtzQXJyWzMzXT1uZXcgQXJyYXkoKTtzQXJy WzMzXVswXT0wO3NBcnJbMzNdWzFdPWZhbHNlO3NBcnJbMzNdWzN dPTE7c0FyclszM11bMl09dHJ1ZTtzQXJyWzM0XT1uZXcgQXJyYX koKTtz...]
  [HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]
  System.Web.UI.ViewStateException.ThrowError(Except ion inner, String persistedState, String errorPageMessage, Boolean macValidationError) +267
  System.Web.UI.ObjectStateFormatter.Deserialize(Str ing inputString) +282
  System.Web.UI.ObjectStateFormatter.System.Web.UI.I StateFormatter.Deserialize(String serializedState) +4
  System.Web.UI.Util.DeserializeWithAssert(IStateFor matter formatter, String serializedState) +37
  System.Web.UI.HiddenFieldPageStatePersister.Load() +198
  System.Web.UI.Page.LoadPageStateFromPersistenceMed ium() +83
  System.Web.UI.Page.LoadAllState() +35
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7350
  System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
  System.Web.UI.Page.ProcessRequest() +86
  System.Web.UI.Page.ProcessRequestWithNoAssert(Http Context context) +18
  System.Web.UI.Page.ProcessRequest(HttpContext context) +49
  ASP.admin_articleadd_aspx.ProcessRequest(HttpConte xt context) +4
  System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute() +358
  System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +64
  解决方法:
  解决方案(1)
  处理页面增加
  
  解决方案(2)推荐
  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值