我在我工作的网络服务器(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/
我得到以下结果:
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..
该网站能够正常上传新包,但命令行却没有。如果我在运行fiddler的情况下尝试push命令,它会在执行push命令时观察到两个连续的请求。一个人似乎正在触摸该网站以确保它在那里,而第二个是实际的推送命令。
Request 1: GET http://somenearbyserver/ 200 OK
Request 2: PUT http://somenearbyserver/api/v2/package/ 500 Internal Server Error
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>
我在命令行中使用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
还包括一些帮助文本,基于验证权限等的建议,但据我所知,权限没有任何问题。
答案 0 :(得分:22)
我通过更改IIS用户的权限来解决此问题。我为IIS_IUSRS
添加了写权限。
右键点击IIS > edit permissions > security
从那里添加用户或组并授予他们写入权限。
答案 1 :(得分:1)
我假设您指的是新图库:https://github.com/NuGet/NuGetGallery
您是否可以尝试从管理员帐户访问/elmah.axd,看看您是否获得了有关错误的更多信息?
答案 2 :(得分:0)
由于没有提到,这是我的情景:
我能够毫无问题地推送(和检索)大多数包。但是,当我试图推送它时,一个包导致404错误。在线的几个消息来源表示我应该为.nupkg添加一个mime类型,但所有这些(无论mime类型)都将错误转换为500内部服务器错误。
事实证明,有问题的软件包比正常情况稍大,IIS将默认请求限制限制为30MB,causing the nuget server to return this obscure error。将设置system.webServer.security.requestFiltering.requestLimits.maxAllowedContentLength
更改为更大的设置可以解决它(在我删除了我添加的mime类型之后)。
答案 3 :(得分:0)
我建议您转到IIS主机服务器并打开eventvwr,您应该能够准确说明错误发生的原因。 在Windows日志/应用程序中查看
在我看来,这是因为磁盘已满。消息看起来像这样:
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.**
...
...