docker.net-coreneo4jdocker-composeneo4jclient

neo4j & .NetCore Docker setup


I want to setup my neo4j database and my .NetCore Web Api with Docker. I created the following docker-compose file :

version: '3.4'

services:
  server:
    image: ${DOCKER_REGISTRY-}server
    network_mode: "bridge"
    build:
      context: .
      dockerfile: Server/Dockerfile
    stdin_open: true
    tty: true
    environment:
      - CHOKIDAR_USEPOLLING=true
    depends_on:
      - neo4j
  neo4j:
    image: "neo4j:latest"
    network_mode: "bridge"
    ports:
      - "7474:7474"
      - "7687:7687"
    volumes:
      - $HOME/neo4j/data:/data
      - $HOME/neo4j/logs:/logs
      - $HOME/neo4j/import:/var/lib/neo4j/import
      - $HOME/neo4j/plugins:/plugins
    environment:
      - NEO4J_AUTH=neo4j/admin

Within my .NetCore Server I check whether I can reach the neo4j address (172.17.0.3:7474), which works. Connecting to the Neo4J Database does not work with the following code :

_client = new GraphClient(new Uri("http://172.17.0.3:7474/db/data/"), "neo4j", "admin");
_client.Connect();

The error message is :

System.Exception: 'Received an unexpected HTTP status when executing the request.

The response status was: 404 Not Found

Solution

  • The library doesn't fully support Neo4j 4.x yet -still in development-.

    You can either use an older image of Neo4j (using Neo4j:3.5.19 connects successfully), or you can use a different driver.