_@gormy, we have moved this bug from https://github.com/dotnet/cli/issues/2674 since this seems to be a NuGet issue._
Windows Server 2012 x64
I have solution with 4 projects. When I try run 'dotnet restore' from TeamCity runner, don`t load all packages,
Load all packages from nuget
Load packages only in first 100 seconds.
dotnet restore output:
before 10000ms:
...
[repo-initialize] info : OK https://api.nuget.org/v3-flatcontainer/microsoft.aspnet.fileproviders.embedded/1.0.0-rc1-final/microsoft.aspnet.fileproviders.embedded.1.0.0-rc1-final.nupkg 93953ms
[repo-initialize] info : OK https://api.nuget.org/v3-flatcontainer/system.console/index.json 95377ms
[repo-initialize] info : GET https://api.nuget.org/v3-flatcontainer/microsoft.aspnet.fileproviders.abstractions/index.json
[repo-initialize] info : GET https://api.nuget.org/v3-flatcontainer/system.reflection/4.0.10/system.reflection.4.0.10.nupkg
[repo-initialize] info : GET https://api.nuget.org/v3-flatcontainer/system.console/4.0.0-beta-23516/system.console.4.0.0-beta-23516.nupkg
[repo-initialize] info : OK https://api.nuget.org/v3-flatcontainer/entityframework.relational.design/index.json 97882ms
[repo-initialize] info : GET https://api.nuget.org/v3-flatcontainer/entityframework.relational.design/7.0.0-rc1-final/entityframework.relational.design.7.0.0-rc1-final.nupkg
...
after 100000ms
...
[repo-initialize] info : An error was encountered when fetching 'GET https://api.nuget.org/v3-flatcontainer/system.linq.queryable/index.json';. The request will now be retried.
[repo-initialize] info : The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/system.linq.queryable/index.json'; has timed out after 100000ms.
...
Hey @gormy, a couple questions to help understand the environment:
--disable-parallel help?dotnet new in a new directory then dotnet restore cause the problem?I have tried this restore on a Windows Server 2012 (not R2) machine and had did not see any problem. Does performing a similar restore using NuGet.exe (download from dist.nuget.org/index.html)? Could you try the v3.4.3 and v3.3.0 NuGet.exe?
Also, when you reproduce the problem, could you use Fiddler to capture the network failures? Since I am not able to reproduce it locally, it's hard for me to get a grasp of what is going on.
I download latest nuget.exe and now if I use 'dotnet restore' from cmd, all packages restored. But in TeamCity I still the same errors. Fiddler don`t see requests from teamcity.
So, to clarify:
nuget.exe restore from CMD on your TeamCity agent works. Which nuget.exe version are you trying?dotnet restore from CMD on your TeamCity agent works.dotnet restore when running as part of the TeamCity build fails.Does that accurately represent the problem?
dotnet restore command result from cmd different from teamcity.
PS C:\TeamCity\buildAgent\work\e602d2b9cd736a2c\test> dotnet restore
log : Restoring packages for C:\TeamCity\buildAgent\work\e602d2b9cd736a2c\test\project.json...
info : GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json
info : NotFound https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json 595ms
info : GET https://myget-2e16.kxcdn.com/artifacts/aspnetvnext/nuget/v3/flatcontainer/microsoft.netcore.app/index.json
info : GET https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.netcore.app/index.j
on
info : OK https://myget-2e16.kxcdn.com/artifacts/aspnetvnext/nuget/v3/flatcontainer/microsoft.netcore.app/index.json
25ms
info : NotFound https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.netcore.app/in
ex.json 582ms
error: Unable to resolve 'Microsoft.NETCore.App (>= 1.0.0-rc2-3002543)' for '.NETCoreApp,Version=v1.0'.
info : Committing restore...
log : Writing lock file to disk. Path: C:\TeamCity\buildAgent\work\e602d2b9cd736a2c\test\project.lock.json
log : C:\TeamCity\buildAgent\work\e602d2b9cd736a2c\test\project.json
log : Restore failed in 104013ms.
Errors in C:\TeamCity\buildAgent\work\e602d2b9cd736a2c\test\project.json
Unable to resolve 'Microsoft.NETCore.App (>= 1.0.0-rc2-3002543)' for '.NETCoreApp,Version=v1.0'.
NuGet Config files used:
C:\Users\Administrator\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
https://api.nuget.org/v3/index.json
http://www.myget.org/F/aspnetvnext/api/v3/index.json
Now, when I try to use dotnet restore for my project from CMD, I the same result as in TeamCIty. How can I check which version nuget is use dotnet?
.NET CLI version 1.0.0-rc2-002485 shipped with NuGet build 3.5.0-beta-1199.
The NuGet version that ships with dotnet does not necessarily have a corresponding nuget.exe release. But you can find the NuGet build number by:
dotnet executable.sdk\<CLI version>.NuGet.Versioning.dll). 
I understand that problem is in shipped NuGeT. Is it?
We are not able to reproduce this issue on our end. Could you send an email to [email protected] with some Skype contact details? We can work together directly. I won't be able to diagnose this problem unless I have access to the machine.
I send a email to [email protected],
@Gormy, any luck debugging those network or proxy issues you were facing? To reiterate, I would try to figure out why this Powershell command is hanging
Invoke-WebRequest https://api.nuget.org/v3/index.json
I spoke to the OP offline and his issue has been resolved. The issue seemed to be related with some proxy settings and that TeamCity was not running as an administrator and was not related to a failure in NuGet itself.
Hi I'm having the same issue.
Invoke-WebRequest hangs (despite I set TimeoutSec), but after ~5 mins it returns.
PS > Invoke-WebRequest https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.mvc.razor/inde
x.json -TimeoutSec 10StatusCode : 200
StatusDescription : OK
Content : {
"versions": [
"0.0.1-alpha",
"1.0.0-rc2-final",
"1.0.0"
]
}
RawContent : HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: x-ms-request-id,Server,x-ms-version,x-ms-write-protection,Content-Ty
pe,Cache-Control,Last-Modified,ETag,Content-MD5,x-ms...
Forms : {}
Headers : {[Access-Control-Allow-Origin, *], [Access-Control-Expose-Headers, x-ms-request-id,Server,x-ms-vers
ion,x-ms-write-protection,Content-Type,Cache-Control,Last-Modified,ETag,Content-MD5,x-ms-lease-stat
us,x-ms-blob-type,Content-Length,Date,Transfer-Encoding], [Content-MD5, m64ebl0Fdr/CqU3ca0GRsA==],
[X-CDN-Rewrite, Lowercase blobs in v3-flatcontainer]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 83
If i run "nuget restore", either including disable parallel or not, I can get the nugets. But dotnet restore doesn't work.
dotnet --version: 1.0.0-preview3-003223
dotnet --info:
.NET Command Line Tools (1.0.0-preview3-003223)
Product Information:
Version: 1.0.0-preview3-003223
Commit SHA-1 hash: 9d3b727392Runtime Environment:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x64
I was just experiencing this issue today. It turns out the issue was that I was connected to a corporate VPN. If you are having timeout issues restoring packages, definitely make sure there are no VPN connections open, and if so try closing them out and see if that helps.
Hello all,
I could only solve the problem upgrading to powershell version 3 on the link below:
https://www.microsoft.com/en-us/download/details.aspx?id=34595
All the best
I'll add a comment that may help some users that are having troubles with this because my CI server agent is running on a System account.
To diagnose and possibly solve the problem you'll need psexec.exe that can be downloaded here: https://live.sysinternals.com
Then, you can execute Powershell as the System account (from an Administrator command line):
psexec -i -s powershell
Once on the new Powershell console, try this:
Invoke-WebRequest https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.mvc.razor/index.json -TimeoutSec 10
If you get a weird error about the Internet Explorer engine not being available, continue...
I don't know exactly what the problem is but you have to launch Internet Explorer under the System account:
psexec -s -i "%programfiles%\Internet Explorer\iexplore.exe"
Then just close it (I went to internet options, but I don't think is necessary).
Try again the Invoke-WebRequest command and it should work.
From now on my problems with dotnet restore through the CI server disappeared. I hope this helps someone!
Thanks @mcliment - I was experiencing the same issue on our CI server, and your solution worked perfectly.
The fix proposed by @mcliment works, just be sure to use psexec with "-u accountname" if you service runs under different account. :)
Unfortunately, @mcliment's answer doesn't fix it for us. We can dotnet new and dotnet restore successfully, but the TeamCity restore still times out.
Most helpful comment
I'll add a comment that may help some users that are having troubles with this because my CI server agent is running on a System account.
To diagnose and possibly solve the problem you'll need
psexec.exethat can be downloaded here: https://live.sysinternals.comThen, you can execute Powershell as the System account (from an Administrator command line):
psexec -i -s powershellOnce on the new Powershell console, try this:
Invoke-WebRequest https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.mvc.razor/index.json -TimeoutSec 10If you get a weird error about the Internet Explorer engine not being available, continue...
I don't know exactly what the problem is but you have to launch Internet Explorer under the System account:
psexec -s -i "%programfiles%\Internet Explorer\iexplore.exe"Then just close it (I went to internet options, but I don't think is necessary).
Try again the
Invoke-WebRequestcommand and it should work.From now on my problems with
dotnet restorethrough the CI server disappeared. I hope this helps someone!