I'm trying to work through the hello world example on the Neo4j .Net driver page but every time I try to run the example, it spins for a while and then throws an exception:
Neo4j.Driver.V1.ServiceUnavailableException: 'Failed after retried for 5 times in 30000 ms. Make sure that your database is online and retry again
I've confirmed my database is running as I can see it through the neo4j browser running at localhost:7474
. I'm trying to create the connection as follows
// 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));
}
I've tried several different variants of the URI (such as using port 7687, like the example says, even though that's not where my instance is running) as well as trying to use http
instead of bolt
as the protocol (which threw a completely different error, saying that's not allowed) to no avail. Anyone know what I might be missing?
You are using the wrong port, that is the UI port. You need to connect to port 7687 (if you are using the defaults, which I assume you are)
using (var greeter = new HelloWorldExample("bolt://localhost:7687", "neo4j", "neo4j"))
{
greeter.PrintGreeting("Hello, World");
}