Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my NuGet Gallery return 500 from nuget push?

Tags:

nuget

I set up the new NuGet Gallery on a web server (under IIS 7.0) where I work. The site itself is set up and runs fine. We are able to register accounts, confirm email addresses, and even upload a new package through the site itself.

Our automated build scripts need to be able to push newly built NuGet packages to the gallery. When I use NuGet's push command:

nuget.exe push build\nuget\BaconAndEggs.1.0.0.1.nupkg 1451002a-8c63-4174-b7ed-73dd3e7bcdf0 -Source http://somenearbyserver/

I get the following result:

Pushing BaconAndEggs 1.0.0.1 to 'http://somenearbyserver/'...
Failed to process request. 'Internal Server Error'.
The remote server returned an error: (500) Internal Server Error..

The website is able to upload a new package just fine, but command line isn't. If I try the push command with fiddler running, it observes two consecutive requests while executing the push command. One appears to be touching the site to make sure it's there, while the second is the actual push command.

Request 1: GET http://somenearbyserver/ 200 OK
Request 2: PUT http://somenearbyserver/api/v2/package/ 500 Internal Server Error

The content of the PUT request is correct, it contains the API key and the payload. Looking on the web server, there are no errors in the event viewer and elmah doesn't catch anything.

Fiddler shows this as the response to the PUT:

HTTP/1.1 500 Internal Server Error
Content-Type: text/html
Server: Microsoft-IIS/7.0
X-Powered-By: ASP.NET
Date: Wed, 18 Jan 2012 20:21:08 GMT
Connection: close
Content-Length: 1208

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>500 - Internal server error.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;} 
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;} 
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} 
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
 <div class="content-container"><fieldset>
  <h2>500 - Internal server error.</h2>
  <h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3>
 </fieldset></div>
</div>
</body>
</html>

I'm using NuGet Version: 1.6.21205.9031 from the command line.

What could the problem be?

EDIT: After enabling detailed error pages on the api folder in the site, I get this with the 500 response described above:

Server Error in Application "NUGET"

Internet Information Services 7.0

Error Summary
HTTP Error 500.0 - Internal Server Error

The page cannot be displayed because an internal server error has occurred.

Detailed Error Information
Module = LiveStreamingHandler
Notification = MapRequestHandler
Handler = WebDAV

Error Code = 0x80070585
Requested URL = http://somenearbyserver:80/api/v2/package/
Physical Path = M:\path\to\nuget-gallery\api\v2\package\
Logon Method = Anonymous
Logon User = Anonymous

There's also some help text included, suggestions based on verifying permissions and such, but as far as I can tell there's nothing wrong with the permissions.

like image 341
John Nelson Avatar asked Jan 17 '12 13:01

John Nelson


People also ask

What does NuGet push do?

The dotnet nuget push command pushes a package to the server and publishes it. The push command uses server and credential details found in the system's NuGet config file or chain of config files.

What is the default NuGet URL?

The location of the service index for nuget.org is https://api.nuget.org/v3/index.json .


2 Answers

In my case it was an old local nuget server. The message I found in the logs:

The schema version of 'YourLib' is incompatible with version 'someVersion.a.b' of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942.

In my case, I downgraded nuget (downloaded an older nuget.exe) and re-created the package. The push now works. I didn't want to disturb the process elsewhere and I needed a quick solution but of course that depends on the scenario one has. In the long run I will update nuget.

like image 186
timtos Avatar answered Oct 10 '22 04:10

timtos


I fixed this issue by changing the permissions for the IIS user. I added write permissions to IIS_IUSRS.

Right click the site in IIS > edit permissions > security

From there you add the user or group and give them write permissions.

like image 34
CJackson234 Avatar answered Oct 10 '22 02:10

CJackson234