加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

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

发布时间:2020-12-15 19:14:25 所属栏目:asp.Net 来源:网络整理
导读:我有一个ASP.NET 2.0应用程序,在我们的当地环境中工作正常。当发布到测试服务器时,我们在服务器上遇到间歇性错误。 以下是最常见的: 填充无效,无法删除。 说明:在执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的起源
我有一个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。以上最终解释它在单服务器上:)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读