【问题标题】:(405) Method Not Allowed with Visual Studio 2017 (NuGet) Package Manager(405) Visual Studio 2017 (NuGet) 包管理器不允许的方法
【发布时间】:2018-07-26 10:21:53
【问题描述】:

我在 Visual Studio 包管理器输出中得到的错误是:

[nuget.org] Unable to load the service index for source https://www.nuget.org/api/v2.
  An error occurred while sending the request.
  The remote server returned an error: (405) Method Not Allowed.

NuGet.config中配置代理或者不配置代理对结果没有影响。

nuget.org 在我的配置中是:

<add key="nuget.org" value="https://www.nuget.org/api/v2" />

如果我将环境 http_proxy 设置为我的公司代理,我可以使用 nuget.exe (NuGet Version: 4.7.0.5148) 重现它

nuget list -source nuget.org -ForceEnglishOutput

Unable to load the service index for source https://www.nuget.org/api/v2.
  An error occurred while sending the request.
  The remote server returned an error: (405) Method Not Allowed.

如果我清除环境 http_proxy 相同的命令开始列出包。 (我使用crtl+c 中止)。

我知道visual studio中的包管理器和nuget.exe是有区别的。

据我了解,两者都使用相同的 nuget.config 文件。 正如我所看到的,包管理器以某种方式使用了我没有检查的代理设置。我找不到那个地方。

是否有我没有检查的代理设置? 我还缺少其他东西吗?

编辑: 当我从 Nuget.Config 中删除代理设置,然后在 Visual Studio 中更新包源时,我的 Nuget.Config 设置被重写,从而恢复了我的代理设置。

【问题讨论】:

    标签: visual-studio proxy nuget nuget-package http-proxy


    【解决方案1】:

    Visual Studio 在内存中保留了一份配置副本。每次包管理器连接它都会重写nuget.config

    所以我的问题通过关闭 vs2017、手动编辑 nuget.config 并重新启动 Visual Studio 解决了。

    【讨论】:

      猜你喜欢
      • 2023-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-01
      • 2013-05-03
      • 1970-01-01
      • 2018-03-14
      相关资源
      最近更新 更多