System.Security.Authentication.AuthenticationException:对 SSPI 的调用失败,请参阅内部异常
Posted
技术标签:
【中文标题】System.Security.Authentication.AuthenticationException:对 SSPI 的调用失败,请参阅内部异常【英文标题】:System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception 【发布时间】:2021-06-25 03:36:06 【问题描述】:突然间,我们的生产服务器出现了严重的不可用错误
以下是我们从日志中发现的异常。
2021-03-26 07:18:11,437 [24] ExecuteReaderQuery 上的错误异常
。 ---> 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 计数,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.ProcessReceivedBlob(字节 [] 缓冲区,Int32 计数,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartReadFrame(字节 [] 缓冲区,Int32 读取字节,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartReceiveBlob(字节 [] 缓冲区,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken 消息,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartSendBlob(字节 [] 传入,Int32 计数,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.ProcessReceivedBlob(字节 [] 缓冲区,Int32 计数,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartReadFrame(字节 [] 缓冲区,Int32 读取字节,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartReceiveBlob(字节 [] 缓冲区,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken 消息,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartSendBlob(字节 [] 传入,Int32 计数,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.ProcessReceivedBlob(字节 [] 缓冲区,Int32 计数,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartReadFrame(字节 [] 缓冲区,Int32 读取字节,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartReceiveBlob(字节 [] 缓冲区,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken 消息,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartSendBlob(字节 [] 传入,Int32 计数,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.ProcessReceivedBlob(字节 [] 缓冲区,Int32 计数,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartReadFrame(字节 [] 缓冲区,Int32 读取字节,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartReceiveBlob(字节 [] 缓冲区,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken 消息,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartSendBlob(字节 [] 传入,Int32 计数,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.ProcessReceivedBlob(字节 [] 缓冲区,Int32 计数,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartReadFrame(字节 [] 缓冲区,Int32 读取字节,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartReceiveBlob(字节 [] 缓冲区,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken 消息,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartSendBlob(字节 [] 传入,Int32 计数,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.ProcessReceivedBlob(字节 [] 缓冲区,Int32 计数,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartReadFrame(字节 [] 缓冲区,Int32 读取字节,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartReceiveBlob(字节 [] 缓冲区,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken 消息,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.StartSendBlob(字节 [] 传入,Int32 计数,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.ForceAuthentication(布尔接收第一,字节 [] 缓冲区,AsyncProtocolRequest asyncRequest)
在 System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResultlazyResult)
在 System.Net.Security.SslStream.AuthenticateAsClient(字符串 targetHost,X509CertificateCollection clientCertificates,SslProtocols enabledSslProtocols,布尔 checkCertificateRevocation)
在 Npgsql.NpgsqlConnector.d__153.MoveNext()
--- 从先前抛出异常的位置结束堆栈跟踪 ---
在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
在 Npgsql.NpgsqlConnector.d__149.MoveNext()
--- 从先前抛出异常的位置结束堆栈跟踪 ---
在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
在 Npgsql.ConnectorPool.d__19.MoveNext()
--- 从先前抛出异常的位置结束堆栈跟踪 ---
在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
在 System.Threading.Tasks.ValueTask`1.get_Result()
在 Npgsql.NpgsqlConnection.c__DisplayClass32_0.
【问题讨论】:
根据报错信息,这个问题似乎是内存不足造成的。你可以增加内存。 【参考方案1】:你试图显示太多信息,你最好使用数据表。
【讨论】:
【参考方案2】:我认为这是一些 DLL Hell 问题。我的应用运行良好,但在操作系统更新后崩溃了。
从 .NET Framework 4.5 更新到 .NET Framework 4.6 并重新编译修复了该问题。
见https://blogs.perficient.com/2016/04/28/tsl-1-2-and-net-support/
【讨论】:
以上是关于System.Security.Authentication.AuthenticationException:对 SSPI 的调用失败,请参阅内部异常的主要内容,如果未能解决你的问题,请参考以下文章