【问题标题】:WebResource.axd Length of the data to decrypt is invalidWebResource.axd 要解密的数据长度无效
【发布时间】:2012-04-28 02:57:20
【问题描述】:

我在事件查看器中有很多看起来像这样的错误。我已经调查了所有可能的解决方案,但仍然没有找到可行的解决方案;

该网站是网络农场的一部分;会话状态存储在状态服务器中; machinekey 在所有服务器上都相同;我什至使用 iiscfg 复制所有服务器上的 iis 设置......仍然没有成功;在 IIS 中,在网站的属性上,我确保未选中“验证文件是否存在”的 axd 映射...

我尝试在 httphandlers 中添加以下行:

<add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="True" />

但还是没有成功……

我真的不知道如何摆脱这个错误。如果有人可以帮助我,我会很感激!

整个堆栈跟踪是:

 Request URL: http://xxxxxxx/WebResource.axd?d=Nu8EdkxldHhw5_nYPoeh3y1EbfLckWGua0HevmQkJr6irkrdL4WYMMP0l2yqOwM7Sd85LYeggTTTURTygkW9tqcBk1Q1&t=634242073212638436 
    Request path: /WebResource.axd 


 at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
   at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
   at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo)
   at System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType)
   at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

【问题讨论】:

  • 嗨 GeoXYZ,我们有同样的问题。你能告诉我是哪个安全更新吗?谢谢!
  • 安全补丁名称为:NDP20SP2-KB2418241-x86.exe
  • 它是 MS 安全公告 10-070 的一部分,KB 数量因您的操作系统/.NET 版本而异。见technet.microsoft.com/en-us/security/bulletin/MS10-070

标签: asp.net webresource.axd


【解决方案1】:

我终于设法修复了这些错误...这是一个安全更新,并未安装在所有服务器上,并导致加密提供不同的值,即使机器密钥在所有服务器上都是相同的。

已经安装好了

【讨论】:

    【解决方案2】:

    希望添加有关此问题的更多详细信息以及一些搜索字词!

    该问题表现为对 WebResource.axd 和 ScriptResource.axd 的请求出现 ASP.Net 错误,例如:

    http//mysite/MyApplication/WebResource.axd?d=966IInUloJ...&t=6332662...

    这将导致以这种方式交付的图像、脚本、样式表和其他资源失败。您会注意到查询字符串上的“d”参数在您的某些主机上会有​​所不同,尽管它们具有相同的validationKey 等...一旦修复,您可以在所有主机上测试相同的查询字符串。


    “/MyApplication”应用程序中的服务器错误。

    要解密的数据长度无效。

    说明:在执行当前 Web 请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

    异常详细信息:System.Security.Cryptography.CryptographicException:要解密的数据长度无效。

    来源错误:

    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.


    堆栈跟踪:

    [CryptographicException: Length of the data to decrypt is invalid.]
       System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) +7588941
       System.Security.Cryptography.CryptoStream.FlushFinalBlock() +33
       System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo) +225
       System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType) +85
       System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context) +179
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
    


    版本信息: Microsoft .NET Framework 版本:2.0.50727.5653; ASP.NET 版本:2.0.50727.4444


    在 windows 事件日志中你可能会看到错误:


    事件类型:警告
    事件源:ASP.NET 2.0.50727.0
    活动类别:网络活动
    事件编号:1309
    日期:2011 年 5 月 23 日
    时间:下午 3:31:13
    用户:不适用
    电脑:我的主机
    描述:
    事件代码:3005
    事件消息:发生未处理的异常。
    活动时间:5/23/2011 3:31:13 PM
    活动时间(UTC):5/23/2011 7:31:13 AM
    事件 ID:a66bd05b39c34da6bc3bfd349aefdf24
    事件顺序:71
    事件发生:21
    事件详细代码:0
    
    应用信息:
        应用域:/LM/W3SVC/98/Root/MyApplication...
        信任级别:完全
        应用程序虚拟路径:/MyApplication
        应用程序路径:d:\inetpub\mysite\MyApplication\
        机器名称:MYHOST
    
    处理信息:
        进程号:15328
        进程名称:w3wp.exe
        帐户名称:NT AUTHORITY\NETWORK SERVICE
    
    异常信息:
        异常类型:CryptographicException
        异常消息:要解密的数据长度无效。
    
    索取资料:
        请求网址:http://mysite/MyApplication/ScriptResource.axd?d=...&t=...
    
        请求路径:/MyApplication/ScriptResource.axd
        用户主机地址:1.1.1.1
        用户:
        是否经过身份验证:假
        认证类型:
        线程帐户名称:NT AUTHORITY\NETWORK SERVICE
    
    线程信息:
        线程 ID:9
        线程帐户名称:NT AUTHORITY\NETWORK SERVICE
        是否冒充:假
        堆栈跟踪:在 System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
       在 System.Security.Cryptography.CryptoStream.FlushFinalBlock()
       在 System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(布尔 fEncrypt,Byte[] buf,Byte[] 修饰符,Int32 开始,Int32 长度,IVType ivType,布尔 useValidationSymAlgo)
       在 System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType)
       在 System.Web.UI.Page.DecryptString(String s)

    有问题的更新是 MS10-070。即使您认为它已安装,您也可能需要重新安装它以修复随后更改的库或其他内容。

    在此更新中值得注意的是 KB2431728 - Encrypted content in ASP.NET is not decrypted or results in errors for a website that uses persisted Forms Authentication cookies or is deployed in a web farm - 请参阅详细信息。

    一些服务器或应用程序 网络场可能会遇到一种或多种 以下症状:... 例外 在 WebResource 或 ScriptResource 处理程序

    ...

    该公告的安全更新 MS10-070 (http://www.microsoft.com/technet/security/bulletin/ms10-070.mspx) 地址更改默认行为 ASP.NET 中的加密。

    ...

    为 ASP.NET 提供服务的所有服务器 网络农场中的网站必须 安装安全更新。如果有些 服务器没有安全性 已安装更新,您必须应用 更新到这些服务器。

    【讨论】:

      【解决方案3】:

      我们有一个网络场,发现根本原因是并非所有服务器都在相同的 Microsoft Windows 补丁级别上运行。一旦我们将它们全部升级到相同的补丁级别,错误就消失了。

      【讨论】:

        【解决方案4】:

        你可能想看看这个:

        http://jagbarcelo.blogspot.com/2009/08/solution-padding-invalid-cannot-be.html

        请注意,我们遇到了类似的问题,在 web.config 中设置机器密钥部分的验证和解密属性似乎有帮助,例如:

        <machineKey validationKey='blah' decryptionKey='blah' validation='AES' decryption='AES'/>
        

        【讨论】:

        • 我的标签是这样的:...你认为这个错误是我没有'没有解密 ='' 属性?
        • @GeoXYZ - 试一试没有坏处 - 我们绕着房子转了几次,尝试不同的事情来解决这个问题。
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-12-19
        • 1970-01-01
        • 2011-12-05
        • 2010-12-22
        • 1970-01-01
        • 2013-04-28
        相关资源
        最近更新 更多