随机无效的视图状态错误 [英] Random Invalid Viewstate Error

查看:113
本文介绍了随机无效的视图状态错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有很多关于这个主题的问题,我已经阅读了他们。

I know there are a lot of questions on this topic and I have read them all.

我使用IIS8,.NET 4.5。

I'm using IIS8, .Net 4.5.

用户随机得到一个无效的视图状态错误,我无法弄清楚。一旦发生这种情况,他们可以重新进入该网站的唯一办法是清除浏览器缓存。

Users randomly get an invalid viewstate error, I can't figure it out. Once this happens the only way they can get back into the site is to clear browser cache.

在我的web.config我有:

In my web.config I have:

<system.web>
<machineKey validationKey='....key here'   decryptionKey='....decrypt key is valid here'   validation='SHA1'/>
    <!--<hostingEnvironment shadowCopyBinAssemblies="false" />-->
    <authentication mode="None" />
    <compilation targetFramework="4.5.1" />
    <httpRuntime targetFramework="4.5.1" />
...
</system.web>

我是一个虚拟专用服务器上运行,而我还没有找到一个比视图状态9KB大。

I'm running on a virtual private server, and I've yet to find a viewstate larger than 9kb.

我的应用程序池设置在凌晨3:00重新开始,每天一次。

My application pool is set to restart at 3:00am, once per day.

我的页面使用更新面板,也许用户点击后退?但我已经看到它发生只是访问该页面没有点击回来。

My page uses update panels, maybe the user is clicking 'back'? But I've seen it happen just visiting the page with no clicking back.

有一件事我注意到的是我必须使用相同的应用程序池标识3个不同的网站,但应用程序池是分开的。有在machine.xml无机键,而只在我的web.config

One thing I noticed is I have 3 different sites using the same application pool identity, but the application pools are seperate. There is no machine keys in machine.xml, but only in my web.config.

推荐答案

一对夫妇的可能性进行调查:

A couple of possibilities to investigate:


  1. 更​​新面板改变表单字段值(这是什么来计算的ViewState),则该页面被回传到服务器,其中的新价值做出验证失败。请参见这个帖子

您已经启用缓存(执行HTTP报头的痕迹 - 确保你没有开发工具打开)。这是导致生成无效的ViewState W / UpdatePanel的脱胶的事情了。

You have caching enabled (perform a trace of HTTP headers - make sure you don't have dev tools open) which is causing invalid ViewState to be generated w/ UpdatePanel gumming things up.

您使用使用Server.Execute地方? (见上面链接一样)

Are you using Server.Execute anywhere? (see above link for same)

(不太可能)贵虚拟专用服务器获得迁移到不同的硬件(也许你不知道它)?

(less likely) Does your "Virtual Private Server" get migrated to different hardware (perhaps without you knowing it)?

这篇关于随机无效的视图状态错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆