使用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 端口的映射。

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

相关推荐
学历真的很重要4 小时前
VsCode+Roo Code+Gemini 2.5 Pro+Gemini Balance AI辅助编程环境搭建(理论上通过多个Api Key负载均衡达到无限免费Gemini 2.5 Pro)
前端·人工智能·vscode·后端·语言模型·负载均衡·ai编程
列逍4 小时前
Linux进程(三)
linux·运维·服务器·环境变量·命令行参数
minji...8 小时前
Linux 基础IO(一) (C语言文件接口、系统调用文件调用接口open,write,close、文件fd)
linux·运维·服务器·网络·数据结构·c++
码龄3年 审核中8 小时前
Linux record 04
linux·运维·服务器
RisunJan8 小时前
Linux命令-ftptop命令(实时监控 ProFTPD 服务器连接状态)
linux·运维·服务器
虾..8 小时前
Linux 文件描述符,重定向及缓冲区理解
linux·运维·服务器
真正的醒悟9 小时前
202503-经验之道
服务器·网络·php
db_cy_20629 小时前
Git对服务器配置文件进行版本控制
运维·服务器·git
qq_251616199 小时前
ubuntu nginx文件服务器
linux·服务器·网络
晚风吹长发10 小时前
初步了解Linux中文件描述符-fd
linux·运维·服务器·c++·开发·文件