2012-01-17 63 views
12

我在我工作的Web服務器(在IIS 7.0下)設置了新的NuGet Gallery。該網站本身設置並運行良好。我們能夠註冊賬戶,確認電子郵件地址,甚至通過網站本身上傳新的軟件包。爲什麼我的NuGet Gallery從nuget push中返回500?

我們的自動構建腳本需要能夠將新建的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.. 

該網站可以上傳一個新的包就好了,但命令行不。如果我嘗試帶着提琴手運行的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 

中也包含了一些說明文字,建議等等,但據我所知,權限沒有問題。

回答

22

我通過更改IIS用戶的權限解決了此問題。我添加了寫入權限IIS_IUSRS

右鍵點擊該網站是在IIS > edit permissions > security

從那裏你添加用戶或組,並給他們寫的權限。

+0

+1。請注意,組名是'IIS_IUSRS'(帶有一個額外的'i')。 – Cameron 2014-10-17 22:40:33

+0

沒有「編輯權限」右鍵點擊一個網站 – 2017-03-13 14:44:26

1

我假設你指的是新的畫廊:https://github.com/NuGet/NuGetGallery

你能嘗試按從管理員帳戶/elmah.axd,看看你得到更多的錯誤信息?

+0

是的,我指的是新的畫廊。我查看了Elmah是否正在錄音,結果什麼也沒有。我甚至在應用程序的文件夾中檢查了錯誤的xml文件,但沒有任何內容。 – 2012-01-22 15:13:26

+0

我想嘗試在開始請求中設置一箇中斷點,以查看管理代碼是否正在被打中。如果沒有,那麼它可能是一個IIS配置問題。 – 2012-01-23 21:58:19

+0

我在我的本地開發機器上運行了項目,並嘗試使用NuGet.exe在本地推包,而且工作得很好。我認爲這絕對是一個IIS配置問題。任何想法什麼是錯誤配置? – 2012-01-24 13:17:40

0

因爲它沒有提到,這裏是我的情況:
我能推(和檢索)大多數包沒有任何問題。但是,當我嘗試推送它時,一個程序包不斷導致404錯誤。網上有幾個消息來源表示,我應該爲.nupkg添加一個mime類型,但是所有這些完成(不管mime類型如何)都是將錯誤轉化爲500內部服務器錯誤。

事實證明,問題包比正常情況稍大,並且IIS將默認請求限制限制在30MB,causing the nuget server to return this obscure error。將設置system.webServer.security.requestFiltering.requestLimits.maxAllowedContentLength更改爲更大的解決方案(在我刪除了添加的MIME類型之後)。

1

就我而言,這是一箇舊的本地nuget服務器。我在日誌中發現的消息:

「YourLib」的架構版本與 版本不兼容「someVersion.a.b」的NuGet的。請從http://go.microsoft.com/fwlink/?LinkId=213942將NuGet升級到最新版本 。

就我而言,我降級的NuGet(下載一箇舊nuget.exe),並重新創建包。推動現在起作用。我不想在其他地方干擾這個過程,我需要一個快速解決方案,但當然這取決於人們的情況。從長遠來看,我會更新nuget。

+0

哪些日誌你找到了消息? – 2017-03-13 14:44:07

相關問題