Validation of viewstate MAC failed解決方法


網(wǎng)站分布在多臺(tái)服務(wù)器,通過(guò)DNS輪回解析到各臺(tái)服務(wù)器,

結(jié)果頁(yè)面只要打開(kāi)停留到DNS解析到下一個(gè)地址,就會(huì)出現(xiàn)出下錯(cuò)誤信息。



 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.
Source Error: 
解決方法:

解決方案(1) 

在處理頁(yè)面增加 
<%@ Page Language="C#"  enableViewStateMac="false" %>


解決方案(2)推薦

在web.config的<system.web>下一行添加:
<machineKey validationKey="B8CEF0C74E23E7197FCC4C9E3617C0007D94D43C7F7A79C582C54B95D69B946DFD49CAF5AA72F9A8CA2CBA040A9DF64DC1DF90DAE1214AE4F1AB7FA56DD65C0D" decryptionKey="D7F1CE31847C4FB31EF51E14F3820D52B659AF8523FC932C03506CC075DB8B28" validation="SHA1" decryption="AES" />


解決方案三


去除域名CDN解析即可


原文鏈接:Validation of viewstate MAC failed解決方法