2017-08-11 97 views
1

因此,我們一直在努力解決NuGet在企業代理背後無法恢復軟件包的問題。我會過去我們的設置。NuGet無法恢復代理背後的軟件包

硬件/軟件:

WinServer 2012 R2 加入域和後面的企業代理

TFS 2017 UPDATE2

的NuGet還原錯誤

基本上我們所做的只是試圖爲我們的環境設置一個構建自動化ENT。現在我們只是試驗它,並且在構建定義中創建了一個基本的Visual Studio應用程序,其中包含一個NuGet Restore步驟。

Sady NuGet Restore步驟失敗,並顯示以下錯誤。從日誌相關的文件都低於:

2017-08-11T13:49:41.7282874Z  Unable to find version '1.5.2' of package 'WebGrease'. 
2017-08-11T13:49:41.7282874Z  https://api.nuget.org/v3/index.json: Unable to load the service index for source https://api.nuget.org/v3/index.json. 
2017-08-11T13:49:41.7282874Z  An error occurred while sending the request. 
2017-08-11T13:49:41.7282874Z  Unable to connect to the remote server 
2017-08-11T13:49:41.7282874Z  A socket operation was attempted to an unreachable network [2606:2800:11f:17a5:191a:18d5:537:22f9]:443 
2017-08-11T13:49:41.7282874Z 
2017-08-11T13:49:41.7282874Z NuGet Config files used: 
2017-08-11T13:49:41.7282874Z  C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\NuGet\NuGet.Config 
2017-08-11T13:49:41.7282874Z 
2017-08-11T13:49:41.7282874Z Feeds used: 
2017-08-11T13:49:41.7282874Z  https://api.nuget.org/v3/index.json 
2017-08-11T13:49:41.8064377Z ##[error]Error: C:\agent\_work\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\4.0.0\NuGet.exe failed with return code: 1 
2017-08-11T13:49:41.8064377Z ##[error]Packages failed to install 
2017-08-11T13:49:41.8064377Z ##[section]Finishing: NuGet restore **\*.sln 

我們試圖

從日誌,該NuGet.config文件位於這裏很明顯:

C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\NuGet\NuGet.config 

當我們修改NuGet.config文件以包含代理設置,如下所示:

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <packageSources> 
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> 
    </packageSources> 
    <config> 
     <add key="http_proxy" value="http://MY_USER_NAME:[email protected]_DOMAIN.com" /> 
    </config> 
</configuration> 

然後誤差也不同:如果服務器連接到互聯網,而無需通過代理

Unable to find version '1.5.2' of package 'WebGrease'. 
     https://api.nuget.org/v3/index.json: Unable to load the service index for source https://api.nuget.org/v3/index.json. 
     An error occurred while sending the request. 
     The remote server returned an error: (400) Bad Request. 

,一切工作正常。

其他人遇到過相同的問題嗎?我們的代理配置是否正確?任何幫助將非常感激。

謝謝。

+0

根據錯誤消息,它應該與您的代理服務器錯誤。它無法連接到「api.nuget.org」網站。請檢查代理服務器是否可以訪問互聯網。並確保沒有策略/防火牆設置來限制代理服務器訪問「api.nuget.org」網站。參考:http://codesteer.com/blog/nuget-work-behind-proxy/ –

+0

安迪,謝謝你的回覆。我與我們的IT人員交談過,他們建議配置VSTS Build Agent在域用戶帳戶下運行,而且這樣做有訣竅,因爲代理允許域用戶通過。之前,我已將VSTS構建代理配置爲在「網絡服務」和「本地系統」帳戶下運行,但其中沒有一個能夠運行。 – WebDev

+0

因此,您已通過將VSTS構建代理配置爲在域用戶帳戶下運行來解決該問題,對吧?如果是這樣,你可以發佈你的解決方法作爲答案和[接受它作爲答案](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work),這可以有益於其他社區成員閱讀此主題。 –

回答

0

解決方案是,您必須將VSTS構建代理配置爲在域用戶帳戶下運行。

+0

謝謝Andy,標記爲答案:) – WebDev