出现Server Error in '/' Application错误,如何解决,急!

sftl25789 2008-11-03 02:29:41
我将生成的网站放上服务器后,没有任何规律的出现如下错误
Server Error in '/' Application.
--------------------------------------------------------------------------------

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.
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 <machineKey> configuration
specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

Source Error:


[No relevant source lines]


Source File: c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\root\09094339\a12fcd99\App_Web_x9zbrj54.0.cs Line: 0

Stack Trace:


[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier,
Int32 start, Int32 length, Int32& dataLength) +2546796
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +214

[ViewStateException: Invalid viewstate.
Client IP: xx.xx.xx.xx
Port: 43624
User-Agent:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 1.7; MAXTHON 2.0)
ViewState:
/wEPDwUJMzI3NTYwMjkyZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYW
NrS2V5X18WAQUITG9naW5CdG4TH0tukP/Jhegloy/sJy85SBNOzw==
Referer: http://www.xxxxx.com/dir1/index.aspx
Path: /dir1/index.aspx]

[HttpException (0x80004005): 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.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage,
Boolean macValidationError) +116
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +251
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37
System.Web.UI.HiddenFieldPageStatePersister.Load() +220
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83
System.Web.UI.Page.LoadAllState() +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +154
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.webmaster_login_aspx.ProcessRequest(HttpContext context) in
c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\09094339\a12fcd99\App_Web_x9zbrj54.0.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

发生的频率不是特高,没有什么规律性。有的时候已登录网站就这样,有的时候是点击某些页面的也会出现。请问这个是什么错误,怎么解决呀?
这个是不是和web.config中的<machineKey>有关系?我没有指定这个元素!!
另外我加入了<authentication mode="Windows"/>!!
...全文
1410 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaobin2878 2008-11-03
  • 打赏
  • 举报
回复
我的网站现在也有这个问题,但我感觉好像是session的问题
jovien 2008-11-03
  • 打赏
  • 举报
回复
新人学习!顶
qinhl99 2008-11-03
  • 打赏
  • 举报
回复
修改当前页面的@page属性,添加enableEventValidation="false" enableViewStateMac="false"
或者在web.config里添加 <pages enableEventValidation="false" enableViewStateMac="false" />
qinhl99 2008-11-03
  • 打赏
  • 举报
回复
http://technet.microsoft.com/en-us/library/cc739441.aspx
sftl25789 2008-11-03
  • 打赏
  • 举报
回复
TO:rejoice123

很感谢你的帮助,但是我加入了<pages enableEventValidation="false" viewStateEncryptionMode ="Never" /> 后,网站立刻报错了,错误如下
Server Error in '/' Application.
--------------------------------------------------------------------------------

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The value of the property 'enableViewStateMac' cannot be parsed. The error is: Never is not a valid value for Boolean.

Source Error:


Line 16: <system.web>
Line 17: <globalization requestEncoding="gb2312" responseEncoding="gb2312" fileEncoding="gb2312"/>
Line 18: <pages enableEventValidation="false" enableViewStateMac="Never">
Line 19: <controls>
Line 20: <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit"/>


Source File: E:\Root\Root\web.config Line: 18


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

我也找到过这个方法,不过和你的不太一样,如下
<pages enableEventValidation="false" viewStateEncryptionMode ="false" />
改过后,网站是正常了,但是不知道有没有效!
soul850522 2008-11-03
  • 打赏
  • 举报
回复
发布的目录有问题,那个生成的config配置文件应该放在要发布的网站的根目录下
ojekleen 2008-11-03
  • 打赏
  • 举报
回复
看上去就像因为服务器集群时各服务器的machingKey不同而导致ViewState的读写错误。。
楼上的方法看看行不行。
mjjzg 2008-11-03
  • 打赏
  • 举报
回复
最有可能的就是Web.Config配置错误
mjjzg 2008-11-03
  • 打赏
  • 举报
回复
最有可能的就是Web.Config配置错误
mjjzg 2008-11-03
  • 打赏
  • 举报
回复
你先放到本地运行,看有什么错误,慢慢排吧,本地排完了,再上传到服务器,看有什么错误,你这直接上传到服务器错误太多
mjjzg 2008-11-03
  • 打赏
  • 举报
回复
这错误也太多了吧
jimu8130 2008-11-03
  • 打赏
  • 举报
回复
http://www.cnblogs.com/huqingyu/archive/2007/08/24/868246.html

http://community.studyez.com/blogs/silentacorn/archive/2007/04/02/Validation-of-viewstate-MAC-failed_025F385E84769F53E056CA53E389B351B965D56C_.aspx

请楼主参考以上两篇文章
Jack123 2008-11-03
  • 打赏
  • 举报
回复
A way to overcome the problem is to set in web.config

<pages enableEventValidation="false" viewStateEncryptionMode ="Never" />

Just note the security implications of these!

or you can adjust the nested form in the master page, everything will be OK.
qhdrenzhijie 2008-11-03
  • 打赏
  • 举报
回复
路过.看不懂
sftl25789 2008-11-03
  • 打赏
  • 举报
回复
忘记说了,服务器就一台,windows 2003+IIS6+Sql server 2000数据库
开发用的VS2005+Sql server 2000数据库
w161134025 2008-11-03
  • 打赏
  • 举报
回复
代码太多,很吓人...
帮你顶
greystar 2008-11-03
  • 打赏
  • 举报
回复
你的服务器是几台机器组成的啊.

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧