使用VSCode远程连接服务器并解决Neo4j无法登陆问题

摘要:本文介绍了如何通过VSCode连接内网部署的Neo4j服务器,并启动服务。在访问Neo4j登录界面时,遇到了端口映射问题导致无法登录。通过手动添加7687端口的映射后,成功登录Neo4j。


我在内网部署了一台服务器,并在其上运行了Neo4j图数据库。由于服务器的访问权限受限,需要通过VPN才能登录到该服务器。为了更方便地编写代码和操作Neo4j,我选择使用Visual Studio Code (VSCode) 来连接这台远程主机,并启动Neo4j服务。

如下图所示,访问 ++http://localhost:7474++ 可以进入neo4j 登陆界面,

这是因为 vscode 连接远程主机后,自动实现端口映射的能力(需要在vscode的终端运行命令才可以)。

在 vscode 界面中点击 PORTS ,就可看到端口映射,如下图所示:

但是输入账号和密码后,遇到了下述报错导致无法登陆。

报错信息是:

复制代码
ServiceUnavailable: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. If you have enabled encryption, ensure your browser is configured to trust the certificate Neo4j is configured to use. WebSocket `readyState` is: 3

为了找到问题的根源,我右键点击了网页,选择了"检查"选项,并进一步点击了"Console"以查看该网站的报错信息。如下图所示,我发现7687端口访问失败是导致无法登录的主要原因。

于是给 vscode 手动添加 7687 端口的映射。

刷新网页,重新登陆,果然登陆成功。

相关推荐
君以思为故30 分钟前
认识Linux -- 进程概念
linux·服务器
weixin_537765801 小时前
【负载均衡】LVS DR模式详解
服务器·负载均衡·lvs
LoneEon2 小时前
告别手动操作:用 Ansible 统一管理你的 Ubuntu 服务器集群
运维·服务器·ansible
摘星|3 小时前
架设一台NFS服务器,并按照以下要求配置
linux·运维·服务器
做运维的阿瑞3 小时前
Linux环境变量持久化完全指南
linux·运维·服务器
天才奇男子4 小时前
从零开始搭建Linux Web服务器
linux·服务器·前端
Wang's Blog4 小时前
MySQL: 服务器性能优化全面指南:参数配置与数据库设计的最佳实践
服务器·数据库·mysql
顾安r4 小时前
11.14 脚本网页 迷宫逃离
服务器·javascript·游戏·flask·html
Orlando cron5 小时前
CPU Load(系统平均负载)
运维·服务器·网络
SUPER52666 小时前
deepseek-R1模型输出时截断异常
运维·服务器·deepseek-r1调用