錯誤合集
channel 1: open failed: administratively prohibited: open failed
channel 2: open failed: administratively prohibited: open failed
channel 3: open failed: administratively prohibited: open failed
channel 4: open failed: administratively prohibited: open failed
channel 5: open failed: administratively prohibited: open failed
channel 1018: open failed: administratively prohibited: open failed
Failed to connect to the remote extension host server (Error: WebSocket close with status code 1006)
其它可能的解決方案
最有效的幾種方法
0)重新啟動主機(即重新啟動Windows)并重新啟動WSL-2計算機,然后再次啟動VSCode。
1)重新安裝vocode
2)刪除~/.vscode - server/?
3)如果有任何進程占用你的連接端口,要么你換端口,要么你kill所有此端口的進程
查看日志
使用xshell或者mobaxterm等遠程連接工具,去查看上面這個日志文件,例如:
vim /home/user/.vscode-server/.dfd34e8260c270da74b5c2d86d61aee4b6d56977.log
然后你自行谷歌/百度錯誤信息,一般也可以解決
ssh相關
1、回滾vscode版本和remote-ssh版本
2、更改ssh相關配置,更改bash相關
3、如果使用SSH密鑰進行連接,則應檢查與SSH密鑰對應的條目~/.ssh/authorized_keys
中沒有no-port-forwarding
或permitopen
4、更新ssh版本yum update openssh
磁盤問題
如果發現是服務器磁盤空間爆了,導致.vscode-server文件夾無法創建,一直連不上服務器,就清理不需要的文件
localhost問題
1、如果你的鏈接命令中有localhost,
替換localhost
為127.0.0.1
2、設置remote.WSL.server.connectThroughLocalhost
( setting WSL -> Remote -WSL Through Localhost)從禁用更改為啟用,雖然不知道為什么會發生這種情況,但它在沒有啟用這個設置的情況下工作了很久,然后突然停止了工作。也許虛擬機的IP以某種意想不到的方式改變了?
known_hosts文件沖突
刪除known_hosts文件:VSCode插件Remote-SSH連接遠程服務器錯誤 “could not establish connection *****“_I_am_overflow的博客-CSDN博客
sshd_config文件
修改遠程服務器的sshd_config文件
# vim /etc/ssh/sshd_config
可能需要修改的配置
AllowTcpForwarding no
#AllowTcpForwarding yes
AllowAgentForwarding no
修改完的配置
AllowTcpForwarding yes
AllowAgentForwarding yes
#AddressFamily any
ListenAddress 0.0.0.0:32000
ListenAddress 0.0.0.0:22
ListenAddress 0.0.0.0:12222
如果是連接數過多,可以添加MaxSession參數來進行設置
保存后重啟sshd服務
# systemctl restart sshd
清除緩存
本地的vscode在連接時,顯示Initializing VSCode server,而未連接過的vscode卻顯示Downloading VSCode server。
這時候懷疑是不是本地有相關的配置緩存,可以考慮刪除掉緩存試試C:\Users\Username\AppData\Roaming\Code很快能看到有CachedConfiguration大概在這里。
WSL
- 找出正在運行的 WSL 實例
wsl -l --running
- 終止所有正在運行的 WSL 實例
wsl --shutdown
- 然后只需重新啟動 WSL
wsl