2012-10-16 47 views
0

我的網站上的Web農場,在負載均衡(共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,但仍然遇到問題。

<machineKey 
    validationKey="3B1107F98F6E4ECD868C929C0826C3845058F39B5113CD7E676170F4DBE4D65D83C65BCB166FFFB7F2749214C0CA503D04A956C1681F56C63A2B5D9F5F4B04FC" 
    decryptionKey="3565248537BB78D03CCA78A2E8C757451EDCFD3D7AAE6199420FEE692158B37F" 
    validation="SHA1" decryption="AES" 
    /> 

有沒有建議嗎?謝謝

回答

0

我從這裏拿它Validation of viewstate MAC failed- Server Error in '/' Application

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

The problem with the above solution is that you sacrifice some security. The next "quick fix" is to add the following to the web.config, but there are drawbacks to this as well:

<pages enableViewStateMac="false"> 

兩個上面的代碼可以解決你的問題。