You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何修复Windows版VS Code的“Error while fetching extensions, XHR failed”错误

VS Code扩展搜索XHR失败问题的解决方法
  • 检查系统代理与VS Code代理配置匹配

    • 打开VS Code设置(快捷键Ctrl+,),搜索http.proxy,确认填写了正确的代理地址(格式示例:http://127.0.0.1:xxxx);若代理使用自签证书,需设置http.proxyStrictSSL为false
    • 关闭系统全局代理后重启VS Code,测试是否能正常搜索扩展,排除代理冲突问题
  • 重置VS Code网络相关设置

    • 打开命令面板(快捷键Ctrl+Shift+P),输入Preferences: Open Settings (JSON),删除所有和http.proxy、http.proxySupport、http.proxyStrictSSL相关的配置项,保存后重启VS Code
    • 尝试手动设置http.proxySupport为off,部分环境下关闭代理支持反而能正常连接扩展市场
  • 排查防火墙/杀毒软件拦截

    • 暂时禁用系统防火墙和第三方杀毒软件,测试VS Code是否能访问扩展市场
    • 若禁用后恢复正常,需将VS Code添加到防火墙/杀毒软件的信任列表中
  • 修改扩展市场镜像源

    • 在设置JSON中添加官方源配置:
      "extensionsGallery": {
        "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
        "cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
        "itemUrl": "https://marketplace.visualstudio.com/items"
      }
      
    • 或替换为国内镜像源(如阿里云):
      "extensionsGallery": {
        "serviceUrl": "https://marketplace.visualstudio.aliyun.com/_apis/public/gallery",
        "cacheUrl": "https://vscode.aliyun.com/gallery/index",
        "itemUrl": "https://marketplace.visualstudio.aliyun.com/items"
      }
      

    保存配置后重启VS Code

  • 检查网络DNS设置

    • 切换DNS服务器为公共DNS(如8.8.8.8或114.114.114.114),重启网络后打开VS Code测试
    • 用ping marketplace.visualstudio.com命令测试域名是否能正常解析和连通

内容的提问来源于stack exchange,提问作者devbar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 23:44:56