3

我们有一个网络服务,我们想签署一个传入的请求并进一步发送它。我们正在使用 System.Security.Cryptography.RSACryptoServiceProvider 的静态对象,并且每个实例都使用相同的静态对象对其进行签名。我在微软上读到静态对象对于这个类是线程安全的。

问题是,在 web 服务负载很重的情况下,签名失败,但出现以下异常:

    `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)`
4

0 回答 0