0
votes

i can't seem to make Neo4jclient to work with neo4j when HTTPS is enabled. Error happens at connect.

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

It works perfectly fine when it's only HTTP.

This is what i am getting.

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

Has anyone ever tried to make Neo4jClient work with HTTPS support enabled. Thanks in Advance.

1
Hi, can you let me know what the inner exception is of the aggregate exception? If you navigate to the https endpoint in something like Chrome, do you get a certificate warning? - Charlotte Skardon
Exception is:System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure. - jinam

1 Answers

1
votes

I'm pretty sure the problem is because of the certificate not being trusted for the SSL client, in development you can do this before beginning your connections:

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

but this is ONLY FOR DEVELOPMENT don't do this in a production environment as it will make your code trust any and all certificates regardless. For production you'll need to trust any certificate you generate for the https endpoint.

Neo4jClient uses the HttpClient for it's connections and that balks at any non-trusted cert. Once the cert is trusted, the connections will work as for http.