【问题标题】:Visual Studio NuGet package manager not working with relative URI errorVisual Studio NuGet 包管理器无法处理相对 URI 错误
【发布时间】:2017-02-06 11:35:19
【问题描述】:

我在使用 Visual Studio Enterprise 2015 Update 3 上的 Nuget 包管理器和扩展和更新管理器时遇到问题。 此工具可以列出已安装的包,但无法访问在线包。

Nuget 包管理器在输出中写入此错误: [nuget.org] 无法加载源 https://api.nuget.org/v3/index.json 的服务索引。 Cette opération n'est pas Prize en charge pour un URI relatif。 (相对 URI 不支持此操作)

扩展和更新管理器显示相同的错误。

我尝试修复 Visual Studio,检查我的操作系统上没有代理,环境变量中没有 http_proxy,删除 Visual Studio 用户设置。

Fiddler 不记录任何信息。

有人有想法吗?

谢谢。

【问题讨论】:

  • 你使用任何 Nuget,config 文件吗?
  • 你能在浏览器中打开包源吗?请检查 NuGet.config 是否包含具有相对文件路径的包源。不支持具有相对文件路径的包源。位于解决方案文件夹或 %AppData%\NuGet\nuget.config 中的 NuGet.config 文件。尝试删除相对文件路径并重启VS,然后再次访问在线包。
  • %AppData%\NuGet\nuget.config 文件是标准的:api.nuget.org/v3/index.json" protocolVersion="3" /> ` 奇怪的是,在浏览在线程序集时,我在经典的扩展​​和更新弹出窗口中遇到了同样的错误。
  • @Aurelien Dolande,您安装了哪个版本的 Nuget 包管理器?您是否尝试卸载并重新安装 NuGet 包管理器的扩展?如果所有这些对您没有帮助,请在浏览在线程序集时分享经典扩展和更新弹出窗口中的错误屏幕截图。

标签: visual-studio-2015 nuget uri relative-path


【解决方案1】:

找到了!

我已经使用 /log 选项启动了 Visual Studio。

日志文件中的堆栈跟踪是:

Unexpected exception Cette opération n'est pas prise en charge pour un URI relatif.
System.Uri.get_Host()

Microsoft.VisualStudio.CommonIDE.VsWebProxy.<PrepareWebProxyAsync>d__6.MoveNext()
--- Fin de la trace de la pile partir de l'emplacement précédent au niveau duquel l'exception a été levée ---

System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

Microsoft.VisualStudio.CommonIDE.VsWebProxyService.<>c__DisplayClass9_0.<<PrepareWebProxyAsync>b__0>d.MoveNext()
--- Fin de la trace de la pile partir de l'emplacement précédent au niveau duquel l'exception a été levée ---

System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)

Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)

Microsoft.VisualStudio.Services.VsTask.GetResult()

Microsoft.VisualStudio.Shell.Connected.ConnectedUser.ConnectedUserManager.<ResolveFWLinkThroughVsWebProxy>d__74.MoveNext()
--- Fin de la trace de la pile

通过反编译一些 VisualStudio dll,我发现它使用了 WebRequest.DefaultWebProxy。在我的计算机上,第三方应用程序修改了我的 machine.config 文件:在 configuration/system.net/defaultProxy 中,指定了一个模块。

评论这部分后,它起作用了。

谢谢!

【讨论】:

  • 很高兴知道您已解决此问题。请标记您的答案,这对遇到相同问题的其他社区有好处。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-11-24
  • 2023-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-03
相关资源
最近更新 更多