0

I'm trying to create an ASP.NET Core Web API project on my Linux system (Ubuntu 22.04) and facing an issue with the dotnet restore or dotnet new command: the process gets stuck during the restore step. Im using the dotnet new webapi -o NewApi command (SDK 8.0).

Determining projects to restore...

/home/john/project-folder/webapp/MyWebApi.csproj : error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json.

Failed to restore /home/john/project-folder/webapp/MyWebApi.csproj (in 10.09 min).

Has anyone encountered this issue before? Any ideas on how to resolve it?

Additional context:

I’ve tried creating other project types (e.g., console apps), and they work fine. The issue seems specific to Web API projects.

I confirmed that my connection to NuGet works by running:

curl https://api.nuget.org/v3/index.json This returns a valid JSON response, so there’s no issue with network connectivity.

1 Answer 1

0

Try to use the following commands to check whether the NuGet source is enabled.

dotnet nuget list source

nuget source list

If not enabled, you can try to enable it using the dotnet nuget enable source <NAME> command.

Or you can directly delete the NuGet.Config file in %appdata%\NuGet(the full path: C:\Users\{username}\AppData\Roaming\NuGet) folder, and then restart the VS tools.

Besides, you could also try to add proxy settings into Nuget.Config file. Refer to this link for details: Nuget Config Section & Nuget Proxy Settings.

Reger to the following similar questions:

Nuget connection attempt failed "Unable to load the service index for source"

Visual Studio - Nuget - Unable to load the service index for source.

Visual Studio 2022 won't connect to NuGet

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.