DotNet4Neo4j / Neo4jClient

.NET client binding for Neo4j
https://www.nuget.org/packages/Neo4jClient
Microsoft Public License
431 stars 146 forks source link

'neo4j' and 'neo4j+s' schemes are not supported #442

Closed kmahendra-cohesion closed 2 years ago

kmahendra-cohesion commented 2 years ago

Unable to connect to neo4j and neo4j+s scheme databases.

Version:

System.AggregateException
  HResult=0x80131500
  Message=One or more errors occurred. (The 'neo4j+s' scheme is not supported.)
  Source=System.Private.CoreLib
  StackTrace:
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()

Expected behavior Being able to connect to and query neo4j and neo4j+s scheme databases.

cskardon commented 2 years ago

Hi!

I know it definitely works with Aura, which is neo4j+s only - so can you show the code you are running, as I can't replicate this.

kmahendra-cohesion commented 2 years ago

Oh, I'm trying to connect to Aura. This is what I attempted to run in my dotnet 6 project:

Startup.cs

public void ConfigureServices(IServiceCollection services)
{
        var client = new GraphClient(new Uri(Configuration["Uri"]),
                Configuration["Username"], Configuration["Password"]);

        client.ConnectAsync().Wait();        // Exception on this line

        services.AddSingleton<IGraphClient>(client);
}
cskardon commented 2 years ago

Sure, so you can't use HTTP to connect to Aura, you need to use Bolt - which means you need to use the BoltGraphClient - so swap GraphClient for BoltGraphClient:

public void ConfigureServices(IServiceCollection services)
{
        var client = new BoltGraphClient(Configuration["Uri"],
                Configuration["Username"], Configuration["Password"]);

        client.ConnectAsync().Wait();        // Exception on this line

        services.AddSingleton<IGraphClient>(client);
}
kmahendra-cohesion commented 2 years ago

Thanks! It worked.