VScode。无法连接到扩展市场

时间:2020-11-10 07:40:59

标签: visual-studio-code

我的设置

Mac osx:Catalina 10.15.5

VS代码

Version: 1.51.0
Commit: fcac248b077b55bae4ba5bab613fd6e9156c2f0c
Date: 2020-11-05T18:14:40.758Z (4 days ago)
Electron: 9.3.3
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 19.5.0

我的问题

我无法使用vscode连接到扩展市场,这里是error message

如果我打开开发人员工具(F1 > Toggle Developer Tools)并检查request to marketplace并显示net::ERR_ACCESS_DENIED

但是我可以将请求复制为curl(right click -> copy and curl),并且可以在我的终端上正常工作

curl 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery' \
  -H 'X-Market-User-Id: f8427084-f361-48f0-b662-fabf315667cf' \
  -H 'Accept: application/json;api-version=3.0-preview.1' \
  -H 'Referer: ' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.51.0 Chrome/83.0.4103.122 Electron/9.3.3 Safari/537.36' \
  -H 'X-Market-Client-Id: VSCode 1.51.0' \
  -H 'Content-Type: application/json' \
  --data-binary '{"filters":[{"criteria":[{"filterType":8,"value":"Microsoft.VisualStudio.Code"},{"filterType":10,"value":"py"},{"filterType":12,"value":"4096"}],"pageNumber":1,"pageSize":50,"sortBy":0,"sortOrder":0}],"assetTypes":[],"flags":946}' \
  --compressed

如果我打开(F1 > Toggle Developer Tools)并转到控制台标签,然后尝试执行其他任何操作,例如 await fetch("https://randomuser.me/api/"),然后我得到the same error(因此,我的vscode似乎一般都无法连接到互联网)

不起作用的东西:

解决方法:

使用VScode内部人员构建可以正常工作,我可以毫无问题地搜索和安装扩展(https://code.visualstudio.com/insiders/

任何帮助表示赞赏。

谢谢

1 个答案:

答案 0 :(得分:0)

我通过更改 http 代理解决了这个问题, 您可以打开vscode设置页面并搜索“代理”, 把Http:proxy改成你的代理或者不设置,然后测试 希望对你有帮助:)