通过 .NET 驱动程序连接非本地 neo4j 服务器
Connect non-local neo4j server via .NET driver
我想通过 .NET 驱动程序连接到远程 neo4J 服务器。
目前我得到
Neo4j.Driver.V1.ServiceUnavailableException: Connection with the server breaks due to AggregateException:
(The rest of the Exception is in german, but it translates to:)
No connection could be established, because the goal-computer refused the connection to 127.0.0.1:7687
我未能修复错误。
我的代码:
Config conf = new Config { EncryptionLevel = EncryptionLevel.None };
using (var driver = GraphDatabase.Driver("bolt://Server-IP:7687", AuthTokens.Basic("neo4j", "neo4j"), conf))
using (var session = driver.Session()) {
var result = session.Run("MATCH (a:Model) RETURN a");
}
Neo4J 设置:
# 默认配置 Neo4j 只接受本地连接。
# 要接受非本地连接,请取消注释此行:
dbms.connectors.default_listen_address=0.0.0.0
我改了这一行,其他的都没动。
我该如何解决这个问题?
- 更改 neo4j.conf 后是否重启了 Neo4j?
- Neo4j 服务器上的 netstat -an 是否显示端口 7474 和 7687 是
侦听 0.0.0.0(而不是 127.0.0.1)
- 您客户端的 nmap -p 7474 Server-ip 是否显示该端口是
打开(关闭或过滤表示有防火墙)
- 同上但端口 7687
如果所有这些都检查过它应该可以工作...
希望对您有所帮助。
此致,
汤姆
我想通过 .NET 驱动程序连接到远程 neo4J 服务器。
目前我得到
Neo4j.Driver.V1.ServiceUnavailableException: Connection with the server breaks due to AggregateException: (The rest of the Exception is in german, but it translates to:) No connection could be established, because the goal-computer refused the connection to 127.0.0.1:7687
我未能修复错误。
我的代码:
Config conf = new Config { EncryptionLevel = EncryptionLevel.None };
using (var driver = GraphDatabase.Driver("bolt://Server-IP:7687", AuthTokens.Basic("neo4j", "neo4j"), conf))
using (var session = driver.Session()) {
var result = session.Run("MATCH (a:Model) RETURN a");
}
Neo4J 设置:
# 默认配置 Neo4j 只接受本地连接。
# 要接受非本地连接,请取消注释此行:
dbms.connectors.default_listen_address=0.0.0.0
我改了这一行,其他的都没动。
我该如何解决这个问题?
- 更改 neo4j.conf 后是否重启了 Neo4j?
- Neo4j 服务器上的 netstat -an 是否显示端口 7474 和 7687 是 侦听 0.0.0.0(而不是 127.0.0.1)
- 您客户端的 nmap -p 7474 Server-ip 是否显示该端口是 打开(关闭或过滤表示有防火墙)
- 同上但端口 7687
如果所有这些都检查过它应该可以工作...
希望对您有所帮助。
此致, 汤姆