C# 调用SSPI失败,请参阅内部异常---&燃气轮机;System.ComponentModel.Win32Exception:无法解密指定的数据

C# 调用SSPI失败,请参阅内部异常---&燃气轮机;System.ComponentModel.Win32Exception:无法解密指定的数据,c#,asp.net,.net,mandrill,C#,Asp.net,.net,Mandrill,一旦我使用mandrill smtp服务器而不是smtp.gmail.com,系统在第一次尝试时(随机)发送一些电子邮件失败,第二次尝试成功。 我有一些类似的帖子,但没有解决我的问题 这是异常跟踪(复制自数据库日志,请原谅跟踪格式不正确) System.Security.Authentication.AuthenticationException:调用SSPI失败,请参阅内部异常。--> System.ComponentModel.Win32Exception:无法读取指定的数据 已解密---内

一旦我使用mandrill smtp服务器而不是smtp.gmail.com,系统在第一次尝试时(随机)发送一些电子邮件失败,第二次尝试成功。 我有一些类似的帖子,但没有解决我的问题

这是异常跟踪(复制自数据库日志,请原谅跟踪格式不正确)

System.Security.Authentication.AuthenticationException:调用SSPI失败,请参阅内部异常。--> System.ComponentModel.Win32Exception:无法读取指定的数据 已解密---内部异常堆栈跟踪结束---位于 System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken 消息,AsyncProtocolRequest,asyncRequest,异常)位于 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken 消息,AsyncProtocolRequest(asyncRequest)位于 System.Net.Security.SslState.StartSendBlob(字节[]传入,Int32 计数,异步协议请求(异步请求) System.Net.Security.SslState.ProcessReceivedBlob(字节[]缓冲区,Int32 计数,异步协议请求(异步请求) System.Net.Security.SslState.StartReadFrame(字节[]缓冲区,Int32 readBytes,AsyncProtocolRequest(异步请求)位于 System.Net.Security.SslState.StartReceiveBlob(字节[]缓冲区, AsyncProtocolRequest(异步请求)位于 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken 消息,AsyncProtocolRequest(asyncRequest)位于 System.Net.Security.SslState.StartSendBlob(字节[]传入,Int32 计数,异步协议请求(异步请求) System.Net.Security.SslState.ProcessReceivedBlob(字节[]缓冲区,Int32 计数,异步协议请求(异步请求) System.Net.Security.SslState.StartReadFrame(字节[]缓冲区,Int32 readBytes,AsyncProtocolRequest(异步请求)位于 System.Net.Security.SslState.StartReceiveBlob(字节[]缓冲区, AsyncProtocolRequest(异步请求)位于 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken 消息,AsyncProtocolRequest(asyncRequest)位于 System.Net.Security.SslState.StartSendBlob(字节[]传入,Int32 计数,异步协议请求(异步请求) System.Net.Security.SslState.ProcessReceivedBlob(字节[]缓冲区,Int32 计数,异步协议请求(异步请求) System.Net.Security.SslState.StartReadFrame(字节[]缓冲区,Int32 readBytes,AsyncProtocolRequest(异步请求)位于 System.Net.Security.SslState.StartReceiveBlob(字节[]缓冲区, AsyncProtocolRequest(异步请求)位于 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken 消息,AsyncProtocolRequest(asyncRequest)位于 System.Net.Security.SslState.StartSendBlob(字节[]传入,Int32 计数,异步协议请求(异步请求) System.Net.Security.SslState.ForceAuthentication(布尔值receiveFirst, 字节[]缓冲区,异步协议请求(异步请求) System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)在System.Net.TlsStream.CallProcessAuthentication(对象 国家)在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext、ContextCallback回调、对象状态、布尔值 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext、ContextCallback回调、对象状态、布尔值 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext、ContextCallback回调、对象状态)位于 System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult结果)位于 System.Net.TlsStream.Write(字节[]缓冲区,Int32偏移量,Int32大小)位于 System.Net.PooledStream.Write(字节[]缓冲区,Int32偏移量,Int32大小) 位于System.Net.Mail.SmtpConnection.Flush()处 System.Net.Mail.ReadLinesCommand.Send(SmtpConnection conn)位于 System.Net.Mail.EHelloCommand.Send(SmtpConnection conn,字符串域) 在System.Net.Mail.SmtpConnection.GetConnection(ServicePoint)上 服务点)在 System.Net.Mail.SmtpTransport.GetConnection(ServicePoint ServicePoint) 位于System.Net.Mail.SmtpClient.GetConnection()处 System.Net.Mail.SmtpClient.Send(MailMessage)位于 Nop.Services.Messages.EmailSender.SendEmail(EmailAccount EmailAccount, 字符串主题、字符串正文、MailAddress发件人、MailAddress收件人、, IEnumerable
1密件抄送,IEnumerable
1抄送,字符串attachmentFilePath,字符串 附件(文件名)位于 Nop.Services.Messages.EmailSender.SendEmail(EmailAccount EmailAccount, 字符串主题、字符串正文、字符串fromAddress、字符串fromName、, 字符串到地址,字符串到名称,IEnumerable
1密件抄送,IEnumerable
1密件抄送, 字符串attachmentFilePath,字符串attachmentFileName)位于 Nop.Services.Messages.QueuedMessagesSendTask.Execute()

下面是用于发送电子邮件的代码块

 using (var smtpClient = new SmtpClient())
  {

            smtpClient.UseDefaultCredentials = emailAccount.UseDefaultCredentials;
            smtpClient.Host = emailAccount.Host;
            smtpClient.Port = emailAccount.Port;
            smtpClient.EnableSsl = emailAccount.EnableSsl;
            if (emailAccount.UseDefaultCredentials)
                smtpClient.Credentials = CredentialCache.DefaultNetworkCredentials;
            else
                smtpClient.Credentials = new NetworkCredential(emailAccount.Username, emailAccount.Password);
            smtpClient.Send(message);
   }

从Internet上窃取:“如果磁盘上的RSACryptServiceProvider中的私钥发生变化,就会发生这种情况。当LSASS.EXE进程尝试完成HTTPS握手时(这对于您的应用程序来说总是超出进程),它发现私钥无法解密使用原始私钥加密的客户端发送的数据。经验教训:虽然它被称为密钥容器,但一次只能保存一个交换密钥。如果需要多个密钥(例如,多个证书),则需要多个容器。“有解决问题的办法吗?不知道。不知道这是不是你的问题。也可能与域相关。祝你好运你在这上面找到什么了吗?