Bắt đầu từ hình thức bây giờ, lần đầu tiên, tôi nhận được lỗi này khi tôi bắt đầu gỡ lỗi ứng dụng MVC của tôiLỗi trên MVC ứng dụng debug: Xác nhận của ViewState MAC thất bại
Validation của viewstate MAC thất bại. Nếu ứng dụng này được lưu trữ bởi một trang web Trang trại hoặc cụm, đảm bảo rằng cấu hình chỉ định cùng một validationKey và xác thực thuật toán . Không thể sử dụng AutoGenerate trong một cụm.
Full stack trace
[ViewStateException: Invalid viewstate.
Client IP: 127.0.0.1
Port:
Referer:
Path: /Login/LogOn
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7
ViewState: Fvq7WNUu+qCC00VbTIOTUuBvK4YHjxp3RubwsrFYW93hKlF7I4GLzaNHceRqjjJB0GwvRPWwlwE6brhAZAo+Mp191B/C+l8Dw/w7aQBDCpWGC3ox6hkSeZp10vbjm9eJFQZmGSPyC1rKYwApBBaz0Q==]
[HttpException (0x80004005): 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.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +198
System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState) +14
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +274
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
System.Web.Mvc.AntiForgeryDataSerializer.Deserialize(String serializedToken) +176
gì này có nghĩa là?
Xin lưu ý: lỗi xảy ra chỉ trong khi gỡ lỗi. Khi tôi triển khai ứng dụng trên IIS mọi thứ hoạt động. Mã xuất hiện trên mã sau trong trang cái của tôi
<form id="__AjaxAntiForgeryForm" action="#" method="post">
<%= Html.AntiForgeryToken() %>
</form>
Thử xóa bộ nhớ cache của trình duyệt của bạn. – UpTheCreek
Chỉ cần thực hiện mà không thành công. Nếu tôi khởi động lại máy tính, mọi thứ hoạt động trong nửa giờ và sau đó vấn đề xuất hiện trở lại ... – Lorenzo
Bạn có đang triển khai ứng dụng của mình trong máy chủ cân bằng tải không? Nếu không, hãy kiểm tra liên kết này tại đây: http://blogs.msdn.com/b/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx. – mallows98