Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

405 Method Not Allowed in NuGet Push

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..

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>

Any ideas on what might be going on?

Thanks!

like image 376
tucaz Avatar asked May 08 '13 22:05

tucaz


4 Answers

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

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.

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

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.

like image 51
tucaz Avatar answered Oct 18 '22 21:10

tucaz


In addition to using nuget push -Source http://nugetserver.com, I did this:

<!--Add the following to the beginning of <system.webServer><modules>:-->
<remove name="WebDAVModule" />
<!--Add the following to the beginning of <system.webServer><handlers>:-->
<remove name="WebDAV" />

Source: Nuget issue #1789

like image 54
Kevin Smyth Avatar answered Oct 18 '22 21:10

Kevin Smyth


I had the same error - in my case, my NuGet environment variable was pointing to an old v2 version of NuGet, and I was trying to push to a v3 feed.

Repointing my environment variable to a v3 NuGet.exe fixed it.

Silly error, but hopefully that might save someone some time.

like image 4
booler Avatar answered Oct 18 '22 21:10

booler


the solution for me - running a local IIS on a Win 8.1 computer -
was to enable "Windows authentication" and "ASP.NET Impersonation"

like image 1
oakman Avatar answered Oct 18 '22 23:10

oakman