c# A对SSPI的调用失败,参见内部异常-无法联系本地安全机构

本文关键字:异常 联系本 机构 安全 内部 SSPI 调用 失败 | 更新日期: 2023-09-27 17:49:27

我写了一个c#程序来连接MySql服务器和' MySql Connector/Net'。我使用ssl选项的安全连接。我使服务器证书和客户端pfx证书太正确。但是当我试图连接到服务器时,我得到了这个异常。

    System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: The Local Security Authority cannot be contacted
   --- End of inner exception stack trace ---
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)

MySql server版本(5.5)被MySql Connector/Net版本(6.9)所支持。

重要提示:它适用于早期的Windows 10,但不适用于最新的Windows 10。我的朋友在Windows 7和8.1上成功地测试了它。也许是Windows更新搞砸了什么。

我在这里读到一个解决方案:必须编辑注册表,但它不起作用。

c# A对SSPI的调用失败,参见内部异常-无法联系本地安全机构

我遇到了同样的问题,我认为这与windows 10的最新安全更新有关。当我将连接字符串更改为SSL加密时,错误就消失了…更新mysql-server-5.5后错误解决