Error 400 when publishing package to simple NuGet.Server repository

Jun 22, 2011 at 1:11 PM


I'm trying to use NuGet 1.4 to publish packages against a NuGet.Server simple repository.

  • I've updated nuget command line to 1.4
  • I've updated nuget repository to 1.4 (paying attention to MagicRoutes broken when updating to v1
  • I've set an api key in web.config
  • I've set the same api key using Nuget.exe setapikey

When I try to upload a .nupkg using NuGet.exe, I get no error :

NuGet.exe push MyPackage.2.2.4148.2.nupkg -Source http://nuget.myserver.lan/nuget/
Pushing MyPackage 2.2.4148.2 to 'http://nuget.myserver.lan/nuget/'...
Pushing: 100%

But when I check the server, there are :

  • No change in RSS
  • No file in Package folder
  • No error in eventlog
  • No error in httperr1.log
  • No error on elmah (I've enabled allowRemoteAccess)

When I watch the request using fiddler, I see this :

POST /nuget/PackageFiles/myApiKey/nupkg HTTP/1.1
Content-Type: application/octet-stream
User-Agent: NuGet Command Line/1.4.20615.182 (Microsoft Windows NT 6.1.7601 Service Pack 1)
Host: nuget.myserver.lan
Content-Length: 358082
Expect: 100-continue

And the corresponding response :

HTTP/1.1 400 Bad Request
Cache-Control: private
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 22 Jun 2011 11:57:01 GMT
Content-Length: 0

So, what's wrong ? What should I do to check why it doesn't work ? Is nuget push really supposed to work against nuget.server ?


Jun 22, 2011 at 8:57 PM

Indeed, nuget.server does not support this. The way to add packages to it is by just dropping them into the Packages folder.

Jun 22, 2011 at 9:00 PM
I thought David Fowler made the push work with the Nuget.Server awhile back. Did it not make it into v1.4?

Jun 22, 2011 at 9:02 PM

Oh, I didn't know that. You might be right. He'll need to comment on this then :)

Jun 22, 2011 at 10:10 PM

It's stated in the release notes:

Jun 22, 2011 at 10:23 PM

Ok, then we're back to the original question of why it's not working for @styx31 :)

Jun 23, 2011 at 12:18 AM

We need to update the nuget.server package. We published the one from the 1.4 branch instead of the 1.4oob branch.

Jun 23, 2011 at 9:18 AM

Is there any workaround I could apply ? Using a specific branch build ?

Do you plan to update the 1.4 or wait for the 1.5 to correct this ?

Jun 23, 2011 at 5:08 PM

We're going to update the package today. If you can't wait, then you can grab NuGet.Core and NuGet.Server from:;jsessionid=52DF1526722E7CF6D21FE325E1FF522E?buildId=1978&tab=artifacts&buildTypeId=bt22##bf5fsgae5g3j,-1tdu3cmta4c2v 

Sep 1, 2011 at 6:25 PM
Edited Sep 1, 2011 at 6:38 PM

I've updated all my code to the 1.5 version, and I still have exactly the same problem : the nuget push command still stays nothing was wrong, but when I check using Fiddler, the server returns me a 400 bad request.

The url has the form "http://nuget.mycompany.lan/nuget/PackageFiles/myAPIkey/nupkg"

Edit : Ok, got it : I was using "NuGet.exe push MyPAckage.nupkg -Source myAPIkey" instead of "NuGet.exe push MyPAckage.nupkg -Source myAPIkey". By bad. The fact that we must change the -source depending if we are publishing or listing/installing package is disturbing.

Sep 1, 2011 at 6:41 PM

Agreed :)