微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

asp.net – “填充无效,不能删除”异常WebResource.axd

我有一个ASP.NET 2.0应用程序,在我们的当地环境中工作正常。当发布到测试服务器时,我们在服务器上遇到间歇性错误

以下是最常见的:

填充无效,无法删除
说明:在执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的起源位置的更多信息。

Exception Details:
System.Security.Cryptography.CryptographicException:
Padding is invalid and cannot be
removed.

Source Error:

An unhandled exception was generated
during the execution of the current
web request. information regarding the
origin and location of the exception
can be identified using the exception
stack trace below.

Stack Trace:

[CryptographicException: Padding is
invalid and cannot be removed.]
System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[]
inputBuffer,Int32 inputOffset,Int32
inputCount,Byte[]& outputBuffer,
Int32 outputOffset,PaddingMode
paddingMode,Boolean fLast) +1545747
System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[]
inputBuffer,Int32
inputCount) +257
System.Security.Cryptography.CryptoStream.FlushFinalBlock()
+30 System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean
fEncrypt,Byte[] buf,Byte[] modifier,
Int32 start,Int32 length,Boolean
useValidationSymAlgo) +164
System.Web.UI.Page.DecryptString(String
s) +83
System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext
context) +148
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+358 System.Web.HttpApplication.ExecuteStep(IExecutionStep
step,Boolean& completedSynchronously)
+64

这发生在对特定WebResource.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.
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
configuration specifies the same
validationKey and validation
algorithm. AutoGenerate cannot be used
in a cluster.

发布表单时偶尔会出现此错误

现在在你跳进去,告诉我这个错误的明显(通常)答案,考虑这:

>应用程序部署到IIS6上的Windows Server 2003
>它不在Web场。此处仅使用一个网络服务器。
>应用程序池标识是一个自定义服务帐户,我运行aspnet_regiss -ga< username>在服务器上。没有效果

解决方法

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

请检查这个更多的信息类似的情况(解释是与一个问题与viewstate验证,但原因是一样的):http://www.developmentnow.com/blog/InvalidViewstate+Or+Unable+To+Validate+Data+Error.aspx

我也一直在想知道了一段时间。在我看到这个问题后,它让我再次:Is this an attempt to break my ASP.Net site’s security? …我刚才回答与非常相同。我感觉它是一些重新启动的东西,因为当我们发布的东西,循环的应用程序的错误显示在日志中,但我没有任何其他来源说明其关系(今天我发现的情况下invalidviewstate因为机器密钥更改:))

Ps。以上最终解释它在单服务器上:)

原文地址:https://www.jb51.cc/aspnet/254614.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐