我们有一个网络服务,我们想签署一个传入请求并进一步发送。我们正在使用System.Security.Cryptography.RSACryptoServiceProvider的静态对象,并且每个实例都使用相同的静态对象来对其进行签名。我在microsoft上读到静态对象对于这个类是线程安全的。
问题是,在webservice上负载很重的情况下,签名失败并出现以下异常:
`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)`