。Net连接到Bolt URI的Neo4jClient失败,但不是Neo4j.Driver

问题描述 投票:0回答:1

我一直在将.Net Core代码从Docker容器内连接到Neo4j DB。我首先尝试使用Neo4jClient,但在docker容器中遇到了http连接问题。然后,我使用host.docker.internal别名localhost的螺栓连接直接尝试了Neo4j.Driver。这很好。我用螺栓(再次从Docker内部)换回了Neo4jClient,但失败了。感谢您的帮助。

Neo4j.Driver.V1.ServiceUnavailableException
  HResult=0x80131500
  Message=Connection with the server breaks due to SecurityException: Failed to establish encrypted connection with server bolt://host.docker.internal:7687/.
  Source=Neo4j.Driver
c# docker neo4j neo4jclient bolt
1个回答
0
投票

[Neo4j的4.x版本要求启用加密,Neo4jClient实际上并未提供执行此操作的简便方法,因此您需要传递IDriver实例,如下所示:

var driver = GraphDatabase.Driver("bolt://localhost:7687", AuthTokens.Basic("neo4j", "neo"), Config.Builder.WithEncryptionLevel(EncryptionLevel.Encrypted).ToConfig());
var client = new BoltGraphClient(driver);
© www.soinside.com 2019 - 2024. All rights reserved.