F:\test>NuGet.exe push MyPackage.1.0.0.0.nupkg -Source http://nugetrepo/ -ApiKey myApiKey
Pushing MyPackage 1.0.0.0 to 'http://nugetrepo:81/'...
Failed to process request. 'Not Found'.
The remote server returned an error: (404) Not Found..
Short version
The cause in my case was that the package was too big. If your package is moderately large you need to set the maxAllowedContentLength setting to a larger number:<system.webserver>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="32212254720"> </requestLimits>
</requestFiltering>
</system.webserver>
This setting controls the biggest file size accepted by IIS. Notice this setting is specified in bytes.
You also need to set ASP.NET's maxRequestLength setting to a corresponding large number (this time in Kb):
<system.web>
<httpRuntime maxRequestLength="31457280" targetFramework="4.5"></httpRuntime>
</system.web>
Full version
Obvious things discarded (wrong api key, wrong URL, server not available, etc) I then turned to Fiddler. 2 requests are made by the NuGet.exe client:- The first one a GET to the site root (http://nugetrepo). This is sucessful.
- A subsequent PUT to http://nugetrepo/api/v2/package which fails with a 404 error.
I went on and enabled IIS Failed Request Tracing (see here) which gave me the key piece of information: the error was a 404.13. For some reason I didn't see that 404.13 on Fiddler.
Once I knew the cause it was fairly straight forward to find the solution.
Hope this helps! It will certainly help myself in the future.