DNU Restore gives lots of “HTTP request timed out”

2020-07-10 10:02发布

问题:

I'm trying to run the samples from https://github.com/aspnet/home.
But I'm having problems updating the references. The restore is very slow and fails for some packages:

  GET http://www.myget.org/F/aspnetvnext/api/v2/FindPackagesById()?id='Microsoft.Framework.Configuration.EnvironmentVariables'
Warning: FindPackagesById: Microsoft.Framework.Configuration.EnvironmentVariables
  HTTP request timed out. Retrying.
  GET http://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Framework.Configuration.EnvironmentVariables'
Warning: FindPackagesById: Microsoft.Framework.Configuration.Ini
  HTTP request timed out. Retrying.
  GET http://www.myget.org/F/aspnetvnext/api/v2/FindPackagesById()?id='Microsoft.Framework.Configuration.Ini'
Warning: FindPackagesById: Microsoft.Framework.Configuration.Ini
  HTTP request timed out. Retrying.
  GET http://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Framework.Configuration.Ini'
Warning: FindPackagesById: Microsoft.Framework.Logging
  HTTP request timed out. Retrying.
  GET http://www.myget.org/F/aspnetvnext/api/v2/FindPackagesById()?id='Microsoft.Framework.Logging'
Warning: FindPackagesById: Microsoft.Framework.Logging
  HTTP request timed out. Retrying.
  GET http://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Framework.Logging'
Warning: FindPackagesById: Newtonsoft.Json
  HTTP request timed out. Retrying.
  GET http://www.myget.org/F/aspnetvnext/api/v2/FindPackagesById()?id='Newtonsoft.Json'
Warning: FindPackagesById: Newtonsoft.Json
  HTTP request timed out. Retrying.
  GET http://www.nuget.org/api/v2/FindPackagesById()?id='Newtonsoft.Json'
Error: FindPackagesById: Microsoft.AspNet.Mvc.Razor
  HTTP request timed out. Exiting.

I tried with different urls using nuget, myget, http, https.
I checked my internet connection. There is a related issue in the dnx repo, but it did not help.
Any workaround to try?

I'm using mono 4.0.3.20 on CentOS.

回答1:

Here is the workaround:

export MONO_THREADS_PER_CPU=2000

from http://www.mono-project.com/archived/articlethreadpool_deadlocks/