调用.RSACryptoServiceProvider.ImportParameters时发生System.ObjectDisposedException [英] System.ObjectDisposedException while calling the .RSACryptoServiceProvider.ImportParameters

查看:169
本文介绍了调用.RSACryptoServiceProvider.ImportParameters时发生System.ObjectDisposedException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我们有一个Web服务,我们希望对传入的请求进行签名并进一步发送.我们正在使用System.Security.Cryptography.RSACryptoServiceProvider的静态对象,并且每个实例都使用相同的静态对象对其进行签名.我在Microsoft上阅读 该类的静态对象是线程安全的.

问题在于,Web服务负载沉重时,签名失败,并出现以下异常:

异常类型:System.ObjectDisposedException
消息:仅当安全手柄未关闭且引用计数为1时,才能设置安全手柄的handle字段.
对象名:
数据:System.Collections.ListDictionaryInternal
TargetSite:无效_ImportKey(System.Security.Cryptography.SafeProvHandle,Int32,System.Security.Cryptography.CspProviderFlags,System.Object,System.Security.Cryptography.SafeKeyHandle ByRef)
帮助链接:NULL
资料来源:mscorlib

StackTrace信息
****************************
   在System.Security.Cryptography.Utils._ImportKey处(SafeProvHandle hCSP,Int32 keyNumber,CspProviderFlags标志,对象cspObject,SafeKeyHandle& hKey)
   在System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters参数)处

有人可以帮助您进行故障排除吗?让我知道是否需要更多信息.

此外,有时它会使.net运行时崩溃,从而使w3wp进程崩溃.谢谢!

Aman.


Amandeep Singh

解决方案

Aman,

欢迎来到MSDN论坛.

我正在尝试让其他人参与此案.

请耐心等待.

此外,您还想发布详细的复制步骤以及您的程序语言,VS版本,.net FM版本等.

谢谢.

最好的问候


Hello,

We have a webservice we would like to sign an incoming request and send it further. We are using the static object of System.Security.Cryptography.RSACryptoServiceProvider and every instance is using the same static object to sign it. I read on microsoft that the static object is thread safe for this class. 

Problem is that on heavy load on webservice, the signing fails with below exception:

Exception Type: System.ObjectDisposedException
Message: Safe handle's handle field can only be set if the safe handle is not closed and has a ref count of 1.
ObjectName: 
Data: System.Collections.ListDictionaryInternal
TargetSite: Void _ImportKey(System.Security.Cryptography.SafeProvHandle, Int32, System.Security.Cryptography.CspProviderFlags, System.Object, System.Security.Cryptography.SafeKeyHandle ByRef)
HelpLink: NULL
Source: mscorlib

StackTrace Information
****************************
   at System.Security.Cryptography.Utils._ImportKey(SafeProvHandle hCSP, Int32 keyNumber, CspProviderFlags flags, Object cspObject, SafeKeyHandle& hKey)
   at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)

Can someone help in troubleshooting the same. Let me know if more information is required.

Also, sometimes it is crashing the .net runtime and hence the w3wp process. Thanks!

Aman.


Amandeep Singh

解决方案

Hi Aman,

Welcome to the MSDN Forum.

I am trying to involve some other one into this case.

Wait it patiently, please.

Additionally, would you like to post a detailed repro steps and your program language, VS edition, .net FM version and so on.

Thank you.

Best regards,


这篇关于调用.RSACryptoServiceProvider.ImportParameters时发生System.ObjectDisposedException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆