c# - Dotnet restore 为 NuGet 包提供 301 错误
问题描述
我的代码昨晚运行良好,但是当我今天尝试使用 恢复它时dotnet restore
,出现以下错误。
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.identity.ui/index.json'.
Response status code does not indicate success: 301 (Moved Permanently).
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/fluentvalidation/index.json'.
Response status code does not indicate success: 301 (Moved Permanently).
Failed to download package 'Microsoft.EntityFrameworkCore.3.1.8' from 'https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore/3.1.8/microsoft.entityframeworkcore.3.1.8.nupkg'.
Response status code does not indicate success: 301 (Moved Permanently).
Failed to download package 'Microsoft.EntityFrameworkCore.3.1.1' from 'https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore/3.1.1/microsoft.entityframeworkcore.3.1.1.nupkg'.
Response status code does not indicate success: 301 (Moved Permanently).
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.extensions.fileproviders.embedded/index.json'.
Response status code does not indicate success: 301 (Moved Permanently).
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/serilog.sinks.console/index.json'.
Response status code does not indicate success: 301 (Moved Permanently).
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/system.text.regularexpressions/index.json'.
Response status code does not indicate success: 301 (Moved Permanently).
我使用的是 Ubuntu 20.04,我的 dotnet 配置如下
.NET Core SDK (reflecting any global.json):
Version: 3.1.414
Commit: 88a3b0c5ca
Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /usr/share/dotnet/sdk/3.1.414/
Host (useful for support):
Version: 3.1.20
Commit: 2833dab8c3
.NET Core SDKs installed:
3.1.414 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
但是,如果我尝试直接访问这些 URL,我可以访问它们吗?我也在使用VPN。会不会是因为这个?