验证视图状态MAC失败。如果此应用程序由Web场或群集托管,请确保< machineKey>配置指定相同的validationKey和验证算法.... [英] 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....
问题描述
你好
我在我的本地系统上托管了一个网站。但它会抛出以下错误。
验证视图状态MAC失败。如果此应用程序由Web场或群集托管,请确保< machinekey> configuration指定相同的validationKey和验证算法。 AutoGenerate不能在群集中使用。
我在web.config中做了如下更改
<? xml version = 1.0 ? >
<! -
有关如何配置ASP.NET应用程序的更多信息,请访问
http ://go.microsoft.com/fwlink/?LinkId = 169433
- >
< span class =code-keyword>< configuration >
< system.web < span class =code-keyword>>
< 编译 debug = true targetFramework = 4.0 >
< 程序集 >
< add assembly = System.Design,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = B03F5F7F11D50A3A / >
< add assembly = System.Windows.Forms,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = B77A5C561934E089 / >
< / assemblies >
< / compilation >
< customErrors mode = 关 > < / customErrors >
< 身份验证 mode = 无 > < / authentication >
< pages enableEventValidation = false viewStateEncryptionMode = < span class =code-keyword>从不 / >
< machineKey 验证 = SHA1 <跨度类= 代码属性>的validationKey 跨度> <跨度类= 代码关键字> = 跨度> <跨度类= 代码关键字 > A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1B2C3D4E5跨度> <跨度类=code-attribute> 解密 = 自动 decryptionKey = A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1 / >
< / system.web >
< connectionStrings >
< add 名称 = constr connectionString = 数据源= RAJEEV-PC;初始目录= Hindalco_muri; Integrated Security = True; / >
< / connectionStrings >
< / configuration >
仍然得到同样的错误。请帮帮我
< blockquote>关闭ViewState MAC是一个非常糟糕的主意,从.NET 4.5.2开始不再支持:
http://blogs.msdn.com/b/webdev/archive/2014/05/07/asp -net-4-5-2-and-enableviewstatemac.aspx [ ^ ]
Microsoft发布了一篇可能有用的知识库文章:
解决视图状态消息验证代码(MAC)错误 [ ^ ]
hello
i have hosted a website on my local system. but it throws following error.
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.
for that i made changes in web.config as follows
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<customErrors mode="Off"></customErrors>
<authentication mode="None"></authentication>
<pages enableEventValidation="false" viewStateEncryptionMode="Never" />
<machineKey validation="SHA1" validationKey="A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1B2C3D4E5" decryption="Auto" decryptionKey="A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1" />
</system.web>
<connectionStrings>
<add name="constr" connectionString="Data Source=RAJEEV-PC; Initial Catalog=Hindalco_muri; Integrated Security=True;"/>
</connectionStrings>
</configuration>
still i m getting same error. please help me
Turning off ViewState MAC is a very bad idea, and is no longer supported as of .NET 4.5.2:
http://blogs.msdn.com/b/webdev/archive/2014/05/07/asp-net-4-5-2-and-enableviewstatemac.aspx[^]
Microsoft have published a knowledgebase article which might help:
Resolving view state message authentication code (MAC) errors[^]
这篇关于验证视图状态MAC失败。如果此应用程序由Web场或群集托管,请确保< machineKey>配置指定相同的validationKey和验证算法....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!