Error 400 when publishing package to simple NuGet.Server repository

Jun 22, 2011 at 12:11 PM

Hi,

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 ?

Thanks,

Jun 22, 2011 at 7: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 8: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 8:02 PM

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

Jun 22, 2011 at 9:10 PM

It's stated in the release notes: http://docs.nuget.org/docs/release-notes/nuget-1.4

Jun 22, 2011 at 9:23 PM

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

Developer
Jun 22, 2011 at 11:18 PM

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 8: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 ?

Developer
Jun 23, 2011 at 4: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:
http://ci.nuget.org:8080/viewLog.html;jsessionid=52DF1526722E7CF6D21FE325E1FF522E?buildId=1978&tab=artifacts&buildTypeId=bt22##bf5fsgae5g3j,-1tdu3cmta4c2v 

Sep 1, 2011 at 5:25 PM
Edited Sep 1, 2011 at 5: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 http://nuget.company.lan/nuget/ myAPIkey" instead of "NuGet.exe push MyPAckage.nupkg -Source http://nuget.company.lan/ myAPIkey". By bad. The fact that we must change the -source depending if we are publishing or listing/installing package is disturbing.

Developer
Sep 1, 2011 at 5:41 PM

Agreed :)