3

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

该网站是网络农场的一部分;会话状态存储在状态服务器中;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)
4

4 回答 4

3

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

安装好了,现在好了

于 2011-02-09T11:00:13.957 回答
1

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

该问题表现为对 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 - ASP.NET 中的加密内容未解密或导致使用持久表单身份验证 cookie 或部署在网络场中的网站出错- 请参阅详细信息。

Web 场中的某些服务器或应用程序可能会遇到以下一种或多种症状:... WebResource 或 ScriptResource 处理程序中的异常

...

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

...

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

于 2011-05-24T04:39:33.363 回答
1

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

于 2012-04-27T18:57:20.953 回答
0

你可能想看看这个:

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

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

<machineKey validationKey='blah' decryptionKey='blah' validation='AES' decryption='AES'/>
于 2011-02-08T16:01:21.533 回答