我试图通过Neo4j .Net driver page上的hello world示例,但每次尝试运行该示例时,它会旋转一段时间然后抛出异常:
Neo4j.Driver.V1.ServiceUnavailableException:'重试后失败 在30000毫秒内5次。确保您的数据库在线并重试 再次
我已经确认我的数据库正在运行,因为我可以通过localhost:7474
运行的neo4j浏览器看到它。我试图按如下方式创建连接
// Invocation in Main method
using (var greeter = new HelloWorldExample("bolt://localhost:7474", "neo4j", "neo4j"))
{
greeter.PrintGreeting("Hello, World");
}
...
// Constructor for HelloWorldExample, and where it's getting hung
public HelloWorldExample(string uri, string user, string password)
{
_driver = GraphDatabase.Driver(uri, AuthTokens.Basic(user, password));
}
我尝试了几种不同的URI变体(比如使用端口7687,就像示例所说的那样,即使这不是我的实例运行的地方)以及尝试使用{{1而不是http
作为协议(抛出一个完全不同的错误,说不允许)无济于事。有人知道我可能会缺少什么吗?
答案 0 :(得分:2)
您使用的是错误的端口,即UI端口。您需要连接到端口7687(如果您使用默认设置,我认为您是)
using (var greeter = new HelloWorldExample("bolt://localhost:7687", "neo4j", "neo4j"))
{
greeter.PrintGreeting("Hello, World");
}