我有一个ASP.NET 2.0应用程序,在本地环境中运行良好.当发布到测试服务器时,服务器上会出现间歇性错误.

以下是最常见的:

填充无效,无法删除.

例外情况详情:

源错误:

生成了未处理的异常 在执行当前 Web请求.有关 异常的来源和位置 可以使用异常 下面的堆栈跟踪.

堆栈跟踪:

[加密例外:填充是

这发生在对特定网络资源的请求上.axd请求.

我们看到的另一个错误是:

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.描述:一个

例外情况详情:

发布表单时偶尔会发生此错误.

在你跳进go 告诉我这个错误的答案之前,请考虑一下:

  • 该应用程序已部署到IIS6上的Windows Server 2003
  • 它不在网络农场上.这里只使用了一个Web服务器.
  • 应用程序池标识是一个自定义服务帐户,我在服务器上运行了aspnet_regiss -ga <username>.没有效果.

推荐答案

错误是因为appdomain已被回收/重新启动.当这种情况发生时,应用程序和机器 keys 被设置为自动,它会改变.这会影响资源url(.axd)的url中信息的解密.设置一个固定的机器 keys 将防止它再次发生.

有关类似 case 的更多信息,请查看此项(解释是viewstate验证存在问题,但原因是相同的):http://www.developmentnow.com/blog/InvalidViewstate+Or+Unable+To+Validate+Data+Error.aspx

I also had been wondering about it for quite a while. After I saw this question it got me on it again: Is this an attempt to break my ASP.Net site's security? ... which I just answered with very much the same. I had the feeling it was around some restart of something, because when we published something that recycled the application the error showed in the log, but I didn't have any other source stating its relation (today I found that case on invalidviewstate because of the machinekey change :))

Ps.以上最后解释了单服务器上的情况:)

Asp.net相关问答推荐

Reaction-Native SignalR连接在调试模式下工作,在释放模式下失败

如何从 dll 文件中提取类的源代码?

无法连接到 ASP.Net 开发服务器问题

格式化 DataBinder.Eval 数据

IIS 将旧用户名返回到我的应用程序

RestSharp 获取请求的完整 URL

如何将 Castle Windsor 与 ASP.Net Web 表单一起使用?

在 RedirectToAction 调用中传播 QueryString 参数

如何在不使用 Session 的情况下在 ASP.net 中的页面之间传递值

是否应该将 project.lock.json 文件签入源代码管理? (ASP.NET 核心 1.0)

如何设置默认页面 asp.net

将查询参数绑定到 ASP.NET Core 中的模型

您使用哪个 .NET Memcached 客户端,EnyimMemcached 与 BeITMemcached?

如何在不预编译的情况下使用命令行msbuild部署VS2012网站项目?

如何在 ASP.NET MVC 中启用跨源请求

当.NET抛出WebException((400)错误请求)时如何处理WebResponse?

HttpContext.Current.Request.Url.Host 它返回什么?

如何强制 netwtonsoft json 序列化程序将 datetime 属性序列化为字符串?

ASP.NET - 从静态方法/静态类访问会话?

Sys.WebForms.PageRequestManagerServerErrorException:处理服务器上的请求时发生未知错误.