2017-08-11 98 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