Neo4jClient HTTPS 支持

Neo4jClient HTTPS Support

启用 HTTPS 后,我似乎无法让 Neo4jclient 与 neo4j 一起工作。连接时发生错误。

var client = new GraphClient(new Uri("https://localhost:7473/db/data"));
                client.Connect();

只有 HTTP 时它工作得很好。

这就是我得到的。

An exception of type 'System.AggregateException' occurred in Neo4jClient.dll but was not handled in user code 

有没有人试过让 Neo4jClient 在启用 HTTPS 支持的情况下工作。 提前致谢。

我很确定问题是因为 SSL 客户端不信任证书,在开发中,您可以在开始连接之前执行此操作:

ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;

但这 仅供开发使用 不要在生产环境中这样做,因为它会使您的代码无论如何都信任任何和所有证书。对于生产环境,您需要信任为 https 端点生成的任何证书。

Neo4jClient 使用 HttpClient 作为它的连接并且拒绝任何不受信任的证书。一旦证书被信任,连接将像 http 一样工作。