最近将我们的.net 4.0 Web应用程序迁移到了.net 4.7.2。 设置开发环境,而不是Web场方案。 机器密钥也不会自动生成。 单击“登录”页面按钮上的“验证视图状态MAC失败”错误。每天在IE和Chrome中,MAC验证总是会失败一次。
Web.config:
<machineKey decryptionKey="F4B786E157C86740A610D....ghfghhgfh3F5C69,IsolateApps" validationKey="80DAFD9....3hgfhgfAC1CDD71B66820B664160337A4C6179C6C1480C8DA6EFD3C17D34B7BCE11A4ED8C02DD0F...3EC5556C4029084A8871,IsolateApps" validation="AES"/>
尝试了以下内容;
但没有运气。
错误:
An unexpected error has occurred on this page and it has been logged. Please feel free to contact us with the information listed below:
GUID: feee9d30-5c42-4130-ad8b-174c14ba9dad
Machine Name Date URL
ZZZ 12/Jun/2019 16:15:22 http://ZZZ:8080/UserManagement/Login.aspx
-------------------------------------
Error Message : Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. See http://go.microsoft.com/fwlink/?LinkID=314055 for more information.
Source : System.Web
Target Method: Void ThrowError(System.Exception, System.String, System.String, Boolean)
Stack Trace : at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose) at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter2 formatter, String serializedState, Purpose purpose) at System.Web.UI.HiddenFieldPageStatePersister.Load() at System.Web.UI.Page.LoadPageStateFromPersistenceMedium() at System.Web.UI.Page.LoadAllState() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
-------------------------------------
Error Message : Invalid viewstate. Client IP: nn.nmn.nn.nn Port: 56640 Referer: http://ZZZ:8080/UserManagement/Login.aspx Path: /UserManagement/Login.aspx User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729) ViewState: N9AFLjJRk5zRjomBHUnBhKTyeeYZgPslJ2437+N8XNzq3+7stdsP1XrS7CU94lXL8m7fvnx50FxdNnBBD2q4Z3HIwMhvup84vACt8nRedbvA/9iTx22OHG00rTvNu3jVRe5KHZXbZI6mK1EULS62LJ0N1eDYe+cZ9KdN80EeMiwvJSeSNKipb+JFPdLVoBtDRs3I7FOcNcEN5MSS6vriyquXN8x6xwRF8zkm4Q7g1KL827Nhu1DGwuF9rd2UYL923eMv5ChZmgnyLFZHoj+QvvMo73NfeTilhM8wuUvex0uCmR/oK4cdq3gUPdwxTPsCbWarFwOJr17nTwVeFFKrdudAZwIPVmvJWqCcBP3wWChSG/7gh0MQu+LOWJ80WL8IeM5CAT4cF8toDzsnHrsEoDuXwksB65Lz741ATcE2l8PUFwrMLnRCXEVKfv8Mz/ohGRuOih2fbM19RviuGvpjPc6Z+8nbh3OjFiAbj7vAvWXXV2cbxXpHUnH25RdiFBtkzQx6DJKGg4uRLDXYEBygOlPB4gk+hj3Ld8mKcnWap3WHj6GMibDdh9IbXEwMDDk6magEnPIrfClJM8YlWxd6mDShhxKJH1CQZvpC9KYMghzBt4KM/WtmGZ3fK9Aihtf9oX3W4HY45yAvSGsAMa27b74P8kY=
答案 0 :(得分:0)
以下是MAC验证错误的原因:
1。如果您的应用程序在服务器场(多服务器环境)中运行
分辨率:
2。检查应用程序池使用的身份,如果IIS工作进程使用应用程序池身份,则可能会引起问题。
分辨率:
3。您的应用程序池设置为LoadUserProfile = false
分辨率:
4.Page.ViewStateUserKey属性的值不正确
分辨率:
有关更详细的解决方案,请参阅Microsoft文章: Resolving view state message authentication code (MAC) errors
关于, 贾帕(Jalpa)