405 Method Not Allowed in NuGet Push

你说的曾经没有我的故事 提交于 2019-12-03 10:26:36
Kevin Smyth

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

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.

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.

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

The fix for me was in IIS. I disabled windows authentication and enabled anonymous authentication.

I was pushing to my own nuget server.

I'm running version 3.1.2. After battling with this problem for a while, the following did it for me:

  • Give write permissions to the Packages folder on the server
  • Because I had deleted the previous packages in the Packages folder, I also had to delete the '*.cache.bin' file in the Packages folder.
  • Ran command as "nuget.exe push {package file} {apikey} -Source {ipaddress:port}/nuget" Note the "/nuget" at the end.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!