gpt4 book ai didi

sockets - VSCode,无法设置用于动态端口转发到远程端口 : connect ECONNREFUSED 的套接字

转载 作者:行者123 更新时间:2023-12-03 07:56:57 25 4
gpt4 key购买 nike

我尝试通过 Microsoft 的远程 SSH 扩展将 VSCode 连接到树莓派 pi4,但每次都会收到 ECONNREFUSED 错误。错误日志:

[14:49:20.954] Starting forwarding server. localPort 58139 -> socksPort 58137 -> remotePort 44131
[14:49:20.954] Forwarding server listening on 58139
[14:49:20.954] Waiting for ssh tunnel to be ready
[14:49:20.955] [Forwarding server 58139] Got connection 0
[14:49:20.956] Tunneled 44131 to local port 58139
[14:49:20.957] Resolved "ssh-remote+192.168.42.1" to "127.0.0.1:58139"
[14:49:20.958] Failed to set up socket for dynamic port forward to remote port 44131: connect ECONNREFUSED 127.0.0.1:58137. Is the remote port correct?
[14:49:20.965] ------




[14:49:20.980] [Forwarding server 58139] Got connection 1
[14:49:20.981] Failed to set up socket for dynamic port forward to remote port 44131: connect ECONNREFUSED 127.0.0.1:58137. Is the remote port correct?

VScode 将成功 ssh 到 pi 并安装 vscode 服务器,但不久之后就会失败。

这是我输入 VSCode 来创建 SSH 主机的行:

ssh -i ~/.ssh/rsa_file <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a6d6cfe6979f948897909e8892948897" rel="noreferrer noopener nofollow">[email protected]</a>

pi 的 ssh 文件有:

Port 22
AllowTcpForwarding yes
AllowAgentForwarding yes
AllowStreamLocalForwarding yes
DisableForwarding no
TCPKeepAlive yes

我的本​​地配置:

Host vscode_to_pi
HostName 192.168.42.1
IdentityFile ~/.ssh/rsa_file
User pi
ForwardAgent yes
ForwardX11 yes
PubKeyAcceptedKeyTypes=+ssh-rsa
HostKeyAlgorithms=+ssh-rsa
StrictHostKeyChecking=no

我已经尝试过:

  1. https://github.com/microsoft/vscode-remote-release/issues/6447
  2. https://github.com/microsoft/vscode-remote-release/issues/4182
  3. SSH Port forwarding failed when trying to connect to remote database via SSH
  4. VSCode Remote SSH Connection Failed
  5. 终止主机上的 VSCode 服务器,重新安装
  6. 重新启动 VSCode

一些注意事项:

  1. 我通过 pi 的 wifi 适配器连接到 pi。该 pi 在连接时不允许访问互联网,但 pi 能够正常安装 VSCode 服务器。
  2. 在扩展程序设置中,“启用代理转发”和“启用动态转发”已打开
  3. 本地服务器下载已关闭。无论如何,如果我连接到 pi,我就无法下载任何内容。
  4. Pi4 debian 版本是 11.3
  5. VSCode 版本是 1.76.2
  6. 远程 - ssh 扩展版本是 v0.101.2023032415

最佳答案

我有同样的情况,我通过删除 ~/.ssh/known_hosts 文件解决了这个问题。

我的操作系统:Mac OS Monterrey

关于sockets - VSCode,无法设置用于动态端口转发到远程端口 : connect ECONNREFUSED 的套接字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75837749/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com