Why does my NuGet Gallery return 500 from nuget push?

13

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.

nuget
asked on Stack Overflow Jan 17, 2012 by John Nelson • edited Jan 24, 2012 by John Nelson

5 Answers

22

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.

answered on Stack Overflow Mar 12, 2012 by CJackson234 • edited Sep 7, 2017 by Brian Ogden
2

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.

answered on Stack Overflow Aug 16, 2016 by timtos • edited Aug 16, 2016 by timtos
1

I assume you're referring to the new gallery: https://github.com/NuGet/NuGetGallery

Can you try hitting /elmah.axd from an admin account and see if you get more info about the error?

answered on Stack Overflow Jan 22, 2012 by David Ebbo
0

Since it's not mentioned, here was my scenario:
I was able to push (and retrieve) most packages without any problems. But, one package kept causing a 404 error when I attempted to push it. Several sources online indicated that I should add a mime-type for .nupkg, however all this accomplished (regardless of the mime type) was to turn the error into a 500 internal server error.

It turns out the package in question was a little larger than normal, and IIS caps the default request limit at 30MB, causing the nuget server to return this obscure error. Changing the setting system.webServer.security.requestFiltering.requestLimits.maxAllowedContentLength to something bigger resolved it for me (after I removed the mime type I had added).

answered on Stack Overflow Oct 17, 2014 by Cameron
0

I suggest you go to the IIS host server an open up the eventvwr, you should be able to tell exactly why the error happened. look in Windows log / Application

In my case it was because of full disk. The message looks like this:

Application information: 
    Application domain: /LM/W3SVC/4/ROOT-1-131895206439239270 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: E:\NuGet.Server\src\NuGet.Server\ 
    Machine name: CM 

Process information: 
    Process ID: 1876 
    Process name: w3wp.exe 
    Account name: NT AUTHORITY\SYSTEM 

Exception information: 
    Exception type: IOException 
    Exception message: **There is not enough space on the disk.**
...
...
answered on Stack Overflow Dec 17, 2018 by Jiří Herník

User contributions licensed under CC BY-SA 3.0