为什么我的NuGet Gallery从nuget push返回500?

Joh*_*son 12 nuget

我在我工作的Web服务器(在IIS 7.0下)上设置了新的NuGet Gallery.该网站本身已设置并运行良好.我们可以注册帐户,确认电子邮件地址,甚至可以通过网站本身上传新包.

我们的自动构建脚本需要能够将新构建的NuGet包推送到库中.当我使用NuGet的push命令时:

nuget.exe push build\nuget\BaconAndEggs.1.0.0.1.nupkg 1451002a-8c63-4174-b7ed-73dd3e7bcdf0 -Source http://somenearbyserver/
Run Code Online (Sandbox Code Playgroud)

我得到以下结果:

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..
Run Code Online (Sandbox Code Playgroud)

该网站能够很好地上传新包,但命令行不是.如果我在运行fiddler的情况下尝试push命令,它会在执行push命令时观察到两个连续的请求.一个人似乎正在触摸该网站以确保它在那里,而第二个是实际的推送命令.

Request 1: GET http://somenearbyserver/ 200 OK
Request 2: PUT http://somenearbyserver/api/v2/package/ 500 Internal Server Error
Run Code Online (Sandbox Code Playgroud)

PUT请求的内容是正确的,它包含API密钥和有效负载.在Web服务器上查看,事件查看器中没有错误,elmah没有捕获任何内容.

Fiddler将此显示为对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>
Run Code Online (Sandbox Code Playgroud)

我正在使用NuGet Version: 1.6.21205.9031命令行.

问题是什么?

编辑:在站点中的api文件夹上启用详细的错误页面后,我得到了上面描述的500响应:

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

还包括一些帮助文本,基于验证权限等的建议,但据我所知,权限没有任何问题.

小智 22

我通过更改IIS用户的权限来解决此问题.我添加了写权限IIS_IUSRS.

右键单击该站点 IIS > edit permissions > security

从那里您添加用户或组并授予他们写入权限.