0

我的网站托管在负载平衡(总共 4 个服务器)环境中的网络场上,但我的一些客户端遇到以下错误:

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"
    />

有什么建议吗?谢谢

4

1 回答 1

-1

我从这里获取它Validation of viewstate MAC failed- Server Error in '/' Application

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

上述解决方案的问题在于您牺牲了一些安全性。下一个“快速修复”是将以下内容添加到 web.config,但这也有缺点:

<pages enableViewStateMac="false">

以上代码都可以解决您的问题。

于 2012-10-16T10:17:53.727 回答