有没有人遇到'验证视图状态MAC失败。如果此应用程序由Web场或群集托管..'错误

时间:2012-08-13 14:05:13

标签: asp.net viewstate

我对此做了一些研究,并尝试插入:

<machineKey decryptionKey="A4B12CCDD50E95F8GB9GFH6JKAT4Y0U0I2OF2DF2AAFE5AB46189C,IsolateApps" validation="AES" validationKey="480CDF2AS9S9AS5CFDGF0GHFH9JJH4KHKAKLJ2L9F3SAS82A6C16911A29EF48903783F94529C21570AACB72766FB38CD4CE7B85B0ACE3149DC5FC1CCF1AA1CECE3579659996593B06,IsolateApps"/>

作为此错误的解决方案:

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.

这次我收到了一个错误。

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

然后它在Config source中标出了一行:

<add name="DemographicDBEntities" connectionString="metadata=res://*/DemoGraph.csdl|res://*/DemoGraph.ssdl|res://*/DemoGraph.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=207.27.57.76,1433;initial catalog=DemographicDB;persist security info=False;user  id=west;pwd=westhouseit;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
<machineKey decryptionKey="A4B12CCDD50E95F8GB9GFH6JKAT4Y0U0I2OF2DF2AAFE5AB46189C,IsolateApps" validation="AES" validationKey="480CDF2AS9S9AS5CFDGF0GHFH9JJH4KHKAKLJ2L9F3SAS82A6C16911A29EF48903783F94529C21570AACB72766FB38CD4CE7B85B0ACE3149DC5FC1CCF1AA1CECE3579659996593B06,IsolateApps"/>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off"/>

机器钥匙标签是否构造良好?我把它全部放在一个标签中。 我在在线主机上托管应用程序,因此我无法使用IIS 7.0生成任何机器代码。我已经提出了几张无效的门票。谢谢你的帮助。

3 个答案:

答案 0 :(得分:1)

我相信问题是IIS无法访问您的webconfig文件。

尝试这一点,如果它不起作用,请查看下面的链接,看看您是否可以尝试并错误地解决您的问题。

1.Open control panel
2.Click on” program” link (not uninstall programs)
3.Click” turn windows features on/off” link
4.locate” Internet Information services IIS” in the pop up window and expand its node
5.Expand the” World Wide Web Service” node
6.Expand “Application Development Features” node
7.check the check box of”ASP.NET”
8.Then click ok button

以下是一个非常有趣的链接,可以帮助您:

http://support.microsoft.com/kb/942055

答案 1 :(得分:1)

我认为您不能手动指定密钥并包含IsolateApps选项。它必须是Autogenerate,IsolateApps或没有IsolateApps选项的特定值。

有关详细信息,请参阅MSDN documentation

答案 2 :(得分:1)

以下是引用Windows 2003和.Net framework 3.5以及Web园设置的错误报告的链接。

没有人说问题仅限于Win 2003甚至框架3.5。在网络花园的情况下,可以想象视图状态错误会经常发生,而不仅仅是在游泳池回收时(正如我们所经历的那样)。

http://connect.microsoft.com/VisualStudio/feedback/details/412881/net-3-5-installer-breaks-web-gardens-when-used-with-custom-application-pool-identity

要修复元数据库和注册表权限问题,我们只需在我们的Web服务器上执行以下操作:

\ Windows \ Microsoft.NET \ Framework \ v2.0.50727 \ aspnet_regiis.exe -ga domain \ useraccount

然后,我们再次回收应用程序池以重新生成视图状态验证密钥。

这是否适用于您的情况取决于具体情况。