无法从Windows连接到Neo4j:无法与服务器建立加密连接

时间:2018-08-14 09:23:53

标签: neo4j

当尝试从Windows计算机上运行的应用程序连接到Neo4j服务器时,我们收到以下错误消息:

  

Neo4j.Driver.V1.SecurityException:无法建立加密   与服务器bolt:// neo4jserver:7687 /连接。   ---> System.Security.Authentication.AuthenticationException:对SSPI的调用失败,请参阅内部异常。   ---> System.ComponentModel.Win32Exception:提供给该函数的令牌无效

Neo4j浏览器工作正常,只有从应用程序到Neo4j的连接失败。这是完整的调用堆栈:

Neo4j.Driver.V1.SecurityException: Failed to establish encrypted connection with server bolt://neo4jserver:7687/. 
---> System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. 
---> System.ComponentModel.Win32Exception: The token supplied to the function is invalid   
--- 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)
   at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
   at Neo4j.Driver.Internal.Connector.TcpSocketClient.Connect(Uri uri)

   --- End of inner exception stack trace ---
   at Neo4j.Driver.Internal.Connector.PooledConnection.OnError(Exception error)
   at Neo4j.Driver.Internal.Connector.DelegatedConnection.Init()
   at Neo4j.Driver.Internal.ConnectionPool.CreateNewPooledConnection()
   at Neo4j.Driver.Internal.ConnectionPool.<>c__DisplayClass41_0.<Acquire>b__0()
   at Neo4j.Driver.Internal.LoggerBase.TryExecute[T](Func`1 func)
   at Neo4j.Driver.Internal.ConnectionPool.Acquire(CancellationToken cancellationToken)
   at Neo4j.Driver.Internal.ConnectionPool.Acquire()
   at Neo4j.Driver.Internal.ConnectionPool.Acquire(AccessMode mode)
   at Neo4j.Driver.Internal.Session.<>c__DisplayClass13_0.<Run>b__0()
   at Neo4j.Driver.Internal.LoggerBase.TryExecute[T](Func`1 func)
   at Neo4j.Driver.Internal.Session.Run(Statement statement)
   at Neo4j.Driver.Internal.StatementRunner.Run(String statement)

1 个答案:

答案 0 :(得分:0)

在客户端计算机上安装所有Windows更新程序即可解决此问题。

事实证明,Neo4j要求客户端在连接时使用TLS 1.2,但是并非所有Windows版本默认都支持它。

可能不需要所有更新,但这是最简单的方法。

这个类似的问题有所帮助:https://github.com/neo4j/neo4j-dotnet-driver/issues/179