ASP.net 视图状态验证 MAC 失败。如果此应用程序由网络场或集群托管

ASP.net Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster

我遇到了这个错误,似乎对我没有任何作用 如果我添加

    <machineKey validationKey="1234567890123456789012345678901234567890AAAAAAAAAA" 
        decryptionKey="123456789012345678901234567890123456789012345678" 
        validation="SHA1" decryption="Auto" />

遇到错误

An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

如果我写

pages validateRequest="false" enableEventValidation="false" viewStateEncryptionMode ="Never"

没有解决我的情况。这是我的系统网站

  <customErrors mode="Off"/>
  <compilation debug="true" targetFramework="4.5.2" />
  <httpRuntime targetFramework="4.5.2" />

有什么帮助吗?

默认情况下 Asp.net 机器密钥是自动生成的,但可以通过在配置中显式定义机器密钥元素来阻止。

注意: machineKey 值必须在 webfarm/cluster 中的所有机器上相同。

this KB 开始,了解有关管理服务器场和集群部署的机器密钥的更多详细信息。

Update

您可以使用此 online utility 通过机器密钥生成机器配置。