无法连接到远程扩展主机服务器 (错误: websocket close with status code 1006)
通过vscode wsl连接ubuntu时一直连接不上显示无法连接到远程扩展主机服务器 (错误: websocket close with status code 1006)
在网上找了许多教程都没有包括但不限于wsl --shutdown、重启、重装等。
最后通过修改.wslconfig文件解决
解决步骤:
1、在 PowerShell 中执行(管理员身份):notepad $env:USERPROFILE.wslconfig
2、编辑文件.wslconfig如下:
[wsl2]
localhostForwarding=true
networkingMode=bridged
保存并退出
3、重启 WSL:wsl --shutdown
4、然后重新启动:wsl
5、然后重启VScode连接








