title: Why does my NuGet Gallery return 500 from nuget push?
body: <p>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.</p>
  
  <p>Our automated build scripts need to be able to push newly built NuGet packages to the gallery. When I use NuGet's push command:</p>
  
  <pre><code>nuget.exe push build\nuget\BaconAndEggs.1.0.0.1.nupkg 1451002a-8c63-4174-b7ed-73dd3e7bcdf0 -Source http://somenearbyserver/
  </code></pre>
  
  <p>I get the following result:</p>
  
  <pre><code>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..
  </code></pre>
  
  <p>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.</p>
  
  <pre><code>Request 1: GET http://somenearbyserver/ 200 OK
  Request 2: PUT http://somenearbyserver/api/v2/package/ 500 Internal Server Error
  </code></pre>
  
  <p>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.</p>
  
  <p>Fiddler shows this as the response to the PUT:</p>
  
  <pre><code>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
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/&gt;
  &lt;title&gt;500 - Internal server error.&lt;/title&gt;
  &lt;style type="text/css"&gt;
  &lt;!--
  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;}
  --&gt;
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="header"&gt;&lt;h1&gt;Server Error&lt;/h1&gt;&lt;/div&gt;
  &lt;div id="content"&gt;
   &lt;div class="content-container"&gt;&lt;fieldset&gt;
    &lt;h2&gt;500 - Internal server error.&lt;/h2&gt;
    &lt;h3&gt;There is a problem with the resource you are looking for, and it cannot be displayed.&lt;/h3&gt;
   &lt;/fieldset&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I'm using <code>NuGet Version: 1.6.21205.9031</code> from the command line.</p>
  
  <p>What could the problem be?</p>
  
  <p><strong>EDIT</strong>: After enabling detailed error pages on the api folder in the site, I get this with the 500 response described above:</p>
  
  <pre>
  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
  
  </pre>
  
  <p>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.</p>