NuGet推送中不允许使用405方法 [英] 405 Method Not Allowed in NuGet Push

查看:387
本文介绍了NuGet推送中不允许使用405方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试进行推送时,我的NuGet服务器抛出405不允许.至少,那就是NuGet控制台所说的:

My NuGet server is throwing a 405 Not Allowed when I try to make a push. At least, thats what NuGet console says:

Failed to process request. 'Method Not Allowed'.
The remote server returned an error: (405) Method Not Allowed..

但是当我用Fiddler查看实际的HTTP响应时,问题似乎完全不同:

But when I look at the actual HTTP response with Fiddler the problem seems to be totally different:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
  <code></code>
  <message xml:lang="en-US">The URL representing the root of the service only supports GET requests.</message>
</error>

有什么想法吗?

谢谢!

推荐答案

在处理了几个小时后,我能够找到问题所在.

After a few hours working on the issue I was able to find the problem.

当您在NuGet服务器中列出软件包时,您指向 http://nugetserver.com/ nuget .但是,当您尝试推送或删除软件包时,您需要指向 http://nugetserver.com ,而无需添加 nuget 文件夹.

When you LIST packages in NuGet server you point to http://nugetserver.com/nuget. However when you are trying to PUSH or DELETE a package you need to point to http://nugetserver.com without the nuget folder in the path.

发生的情况是NuGet.exe将/api/v2/package 附加到URL,将其转换为 http://nugetserver.com/ api/v2/package

What happens is that NuGet.exe append /api/v2/package to the URL turning it into http://nugetserver.com/api/v2/package

我认为这远非最佳选择,因为它会使您向nuget.exe.config中添加两个不同的源:一个用于get/list,另一个用于推送/删除程序包.

I think this is far from optimal because it makes you add two different sources to your nuget.exe.config: one for the get/list and another for pushing/deleting packages.

这篇关于NuGet推送中不允许使用405方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆