我的网站托管在一个负载均衡(总共4个服务器)环境的Web场中 我的一些客户遇到以下错误:
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.
但是,我的四个站点中的每个站点都在web.config文件中具有以下机器密钥,但仍然遇到此问题。
<machineKey
validationKey="3B1107F98F6E4ECD868C929C0826C3845058F39B5113CD7E676170F4DBE4D65D83C65BCB166FFFB7F2749214C0CA503D04A956C1681F56C63A2B5D9F5F4B04FC"
decryptionKey="3565248537BB78D03CCA78A2E8C757451EDCFD3D7AAE6199420FEE692158B37F"
validation="SHA1" decryption="AES"
/>
有什么建议吗?感谢
答案 0 :(得分:0)
我从这里开始Validation of viewstate MAC failed- Server Error in '/' Application。
<pages enableEventValidation="false" viewStateEncryptionMode="Never">
上述解决方案的问题在于你牺牲了一些 安全。下一个“快速修复”是将以下内容添加到 web.config,但也有缺点:
<pages enableViewStateMac="false">
以上代码都可以解决您的问题。