Dotnet还原在生成服务器上失败 [英] Dotnet Restore Failed on Build Server
问题描述
我有一个dotnet核心应用程序,想在jenkins上构建它. 为了实现这一目标,我在构建从站上安装了dotnet内核.
I have a little dotnet core application and want to build it on jenkins. In order to make it happen, ive installed dotnet core on the build slave.
在本地我可以使用相同的命令成功还原(即使在我的Mac上)
Locally i can restore with the same command successfuly (even on my mac)
dotnet restore --configfile .nuget/NuGet.Config
在构建服务器上,一个软件包的还原失败.
On the build server the restore fails for one package.
Started by user jenkins
Building remotely on 2c3bff31e594 in workspace /root/workspace/Test
Cloning the remote Git repository
...
+ dotnet restore --configfile .nuget/NuGet.Config
Welcome to .NET Core!
---------------------
...
log : Installing System.Runtime 4.1.0-rc2-24027.
log : Installing System.Diagnostics.Tools 4.0.1-rc2-24027.
log : Installing System.Reflection.Extensions 4.0.1-rc2-24027.
...
log : Restoring packages for /root/workspace/Test/test/Test.DataAccess.Tests/project.json...
log : Failed to download package from 'https://api.nuget.org/v3-flatcontainer/remotion.linq/2.1.1/remotion.linq.2.1.1.nupkg'.
log : Response status code does not indicate success: 404 (Not Found).
奇怪的是,如果我点击了网址 " https://api.日志中的nuget.org/v3-flatcontainer/remotion.linq/2.1.1/remotion.linq.2.1.1.nupkg "链接,软件包就是它们.
The strange thing here is, that if i hit the url "https://api.nuget.org/v3-flatcontainer/remotion.linq/2.1.1/remotion.linq.2.1.1.nupkg" link from the log, the package is their.
推荐答案
可能是防火墙或任何其他本地设置
probably a firewall or any other local setting
可能是防火墙. id在计算机上安装 fiddler 并查看确切的请求是什么
probably firewall. id install fiddler on the computer and look what is the exact request
像这样添加小提琴手作为nuget porxy:
add fiddler as nuget porxy like this:
https://docs.nuget.org/consume/nuget- config-settings#proxy-settings
Proxy settings
section: config
keys: http_proxy, http_proxy.user, http_proxy.password and no_proxy.
Allows you to set the proxy settings to be used while connecting to your NuGet feed. More details here.
This key can be added using NuGet.exe Config -Set command.
It can also be set via environment variables http_proxy and no_proxy. http_proxy should be specified in the format http://[username]:[password]@proxy.com whereas no_proxy should be a comma-separated list of domains to bypass the proxy server.
Note
The "http_proxy.password" key value is encrypted before storing in the nuget.config file. Hence it can not be added manually by directly updating the config file.
这篇关于Dotnet还原在生成服务器上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!