Home: dotnet restore Unable to load the service index for source https://api.nuget.org/v3/index.json

Created on 7 Jun 2017  路  73Comments  路  Source: NuGet/Home

_From @Xarkam on June 7, 2017 7:25_

Steps to reproduce

Clone https://github.com/ExtCore/ExtCore-Sample-Modular-Ui-Adv

Expected behavior

Restore package

Actual behavior

PS F:\Developpements\ExtCore-Sample-Modular-Ui-Adv> dotnet restore --verbosity diag
C:\Program Files\dotnet\sdk\1.0.4\MSBuild.dll /NoLogo /ConsoleLoggerParameters:Verbosity=Minimal /Logger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,C:\Program F
iles\dotnet\sdk\1.0.4\dotnet.dll /m /t:Restore /v:m /verbosity:diag .\WebApplication.sln
  Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ClientEventHandlers2\ClientEventHandlers2.csproj...
  Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Extension3\Extension3.csproj...
  Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ServerEventHandlers\ServerEventHandlers.csproj...
  Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Barebone\Barebone.csproj...
  Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\WebApplication\WebApplication.csproj...
  Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Infrastructure\Infrastructure.csproj...
  Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ServerEvents\ServerEvents.csproj...
  Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Extension2\Extension2.csproj...
  Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Extension1\Extension1.csproj...
  Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ClientEventHandlers1\ClientEventHandlers1.csproj...
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json.\r [F:\Developpemen
ts\ExtCore-Sample-Modular-Ui-Adv\WebApplication.sln]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error :   An error occurred while sending the request.\r [F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\W
ebApplication.sln]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error :   Failed to connect to server [F:\Developpements\ExtCore-Sample-Modula
r-Ui-Adv\WebApplication.sln]

Environment data

dotnet --info output:

PS F:\Developpements\ExtCore-Sample-Modular-Ui-Adv> dotnet --info
.NET Command Line Tools (1.0.4)

Product Information:
 Version:            1.0.4
 Commit SHA-1 hash:  af1e6684fd

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15063
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\1.0.4

If I use nuget cli for restore, I don't have any problem.

PS F:\Developpements\ExtCore-Sample-Modular-Ui-Adv> h:\nuget restore
MSBuild auto-detection: using msbuild version '15.1.1012.6693' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin'.
Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ServerEvents\ServerEvents.csproj...
Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ClientEventHandlers1\ClientEventHandlers1.csproj...
Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Extension1\Extension1.csproj...
Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Extension3\Extension3.csproj...
Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Extension2\Extension2.csproj...
Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Barebone\Barebone.csproj...
Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ClientEventHandlers2\ClientEventHandlers2.csproj...
Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Infrastructure\Infrastructure.csproj...
Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ServerEventHandlers\ServerEventHandlers.csproj...
Restoring packages for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\WebApplication\WebApplication.csproj...
  GET https://api.nuget.org/v3-flatcontainer/extcore.mvc/index.json
  GET https://api.nuget.org/v3-flatcontainer/extcore.mvc.infrastructure/index.json
  GET https://api.nuget.org/v3-flatcontainer/extcore.events/index.json
  GET https://api.nuget.org/v3-flatcontainer/extcore.webapplication/index.json
  OK https://api.nuget.org/v3-flatcontainer/extcore.webapplication/index.json 247ms
  GET https://api.nuget.org/v3-flatcontainer/extcore.webapplication/1.2.0/extcore.webapplication.1.2.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/extcore.mvc/index.json 498ms
  GET https://api.nuget.org/v3-flatcontainer/extcore.mvc/1.2.0/extcore.mvc.1.2.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/extcore.mvc.infrastructure/index.json 522ms
  CACHE https://api.nuget.org/v3-flatcontainer/extcore.mvc.infrastructure/index.json
  GET https://api.nuget.org/v3-flatcontainer/extcore.mvc.infrastructure/1.2.0/extcore.mvc.infrastructure.1.2.0.nupkg
  CACHE https://api.nuget.org/v3-flatcontainer/extcore.mvc.infrastructure/index.json
  OK https://api.nuget.org/v3-flatcontainer/extcore.events/index.json 555ms
  CACHE https://api.nuget.org/v3-flatcontainer/extcore.mvc.infrastructure/index.json
  GET https://api.nuget.org/v3-flatcontainer/extcore.events/1.2.0/extcore.events.1.2.0.nupkg
  CACHE https://api.nuget.org/v3-flatcontainer/extcore.mvc.infrastructure/index.json
  CACHE https://api.nuget.org/v3-flatcontainer/extcore.events/index.json
  CACHE https://api.nuget.org/v3-flatcontainer/extcore.events/index.json
  CACHE https://api.nuget.org/v3-flatcontainer/extcore.mvc.infrastructure/index.json
  CACHE https://api.nuget.org/v3-flatcontainer/extcore.mvc.infrastructure/index.json
  OK https://api.nuget.org/v3-flatcontainer/extcore.mvc/1.2.0/extcore.mvc.1.2.0.nupkg 117ms
  OK https://api.nuget.org/v3-flatcontainer/extcore.mvc.infrastructure/1.2.0/extcore.mvc.infrastructure.1.2.0.nupkg 123ms
  OK https://api.nuget.org/v3-flatcontainer/extcore.webapplication/1.2.0/extcore.webapplication.1.2.0.nupkg 419ms
  GET https://api.nuget.org/v3-flatcontainer/extcore.infrastructure/index.json
  OK https://api.nuget.org/v3-flatcontainer/extcore.events/1.2.0/extcore.events.1.2.0.nupkg 421ms
  OK https://api.nuget.org/v3-flatcontainer/extcore.infrastructure/index.json 418ms
  CACHE https://api.nuget.org/v3-flatcontainer/extcore.infrastructure/index.json
  CACHE https://api.nuget.org/v3-flatcontainer/extcore.infrastructure/index.json
  GET https://api.nuget.org/v3-flatcontainer/extcore.infrastructure/1.2.0/extcore.infrastructure.1.2.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/extcore.infrastructure/1.2.0/extcore.infrastructure.1.2.0.nupkg 120ms
Installing ExtCore.Events 1.2.0.
Installing ExtCore.Infrastructure 1.2.0.
Installing ExtCore.Mvc.Infrastructure 1.2.0.
Installing ExtCore.WebApplication 1.2.0.
Installing ExtCore.Mvc 1.2.0.
Committing restore...
Generating MSBuild file F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ServerEventHandlers\obj\ServerEventHandlers.csproj.nuget.g.props.
Writing lock file to disk. Path: F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ServerEventHandlers\obj\project.assets.json
Restore completed in 6,24 sec for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ServerEventHandlers\ServerEventHandlers.csproj.
Committing restore...
Generating MSBuild file F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ClientEventHandlers2\obj\ClientEventHandlers2.csproj.nuget.g.props.
Writing lock file to disk. Path: F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ClientEventHandlers2\obj\project.assets.json
Restore completed in 6,64 sec for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ClientEventHandlers2\ClientEventHandlers2.csproj.
Committing restore...
Generating MSBuild file F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Infrastructure\obj\Infrastructure.csproj.nuget.g.props.
Writing lock file to disk. Path: F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Infrastructure\obj\project.assets.json
Restore completed in 7,01 sec for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Infrastructure\Infrastructure.csproj.
Committing restore...
Generating MSBuild file F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ServerEvents\obj\ServerEvents.csproj.nuget.g.props.
Writing lock file to disk. Path: F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ServerEvents\obj\project.assets.json
Restore completed in 7,43 sec for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ServerEvents\ServerEvents.csproj.
Committing restore...
Generating MSBuild file F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Barebone\obj\Barebone.csproj.nuget.g.props.
Writing lock file to disk. Path: F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Barebone\obj\project.assets.json
Restore completed in 7,83 sec for F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Barebone\Barebone.csproj.

NuGet Config files used:
    C:\Users\benjamin\AppData\Roaming\NuGet\NuGet.Config
    C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config

Feeds used:
    https://api.nuget.org/v3/index.json
    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

Installed:
    2 package(s) to F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ClientEventHandlers1\ClientEventHandlers1.csproj
    5 package(s) to F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\WebApplication\WebApplication.csproj
    2 package(s) to F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Extension1\Extension1.csproj
    2 package(s) to F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Extension2\Extension2.csproj
    2 package(s) to F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Extension3\Extension3.csproj
    3 package(s) to F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ServerEventHandlers\ServerEventHandlers.csproj
    3 package(s) to F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ClientEventHandlers2\ClientEventHandlers2.csproj
    2 package(s) to F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Infrastructure\Infrastructure.csproj
    3 package(s) to F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\ServerEvents\ServerEvents.csproj
    2 package(s) to F:\Developpements\ExtCore-Sample-Modular-Ui-Adv\src\Barebone\Barebone.csproj

_Copied from original issue: dotnet/cli#6783_

HttpCommunication Customer Sprint Restore Backlog 2 Investigate Bug

Most helpful comment

Any update team ? This is kinda blocking me from last 4 days.

All 73 comments

@emgarten

@Xarkam is this reproing consistently for you?

Both dotnet restore and msbuild /t:restore run the same code. It is interesting that you see different results between them when making network calls.

@emgarten for the project in logs, yes every time.
I don't have any problems with visual studio 2017 on nuget restore packages.

But, I have not time for testing with another project before 5 days.

@emgarten hello, I have test with this repository: https://github.com/aspnet/MusicStore and the problem is same

PS F:\Developpements\temp\MusicStore> dotnet restore
  Restoring packages for F:\Developpements\temp\MusicStore\test\MusicStore.Test\MusicStore.Test.csproj...
  Restoring packages for F:\Developpements\temp\MusicStore\test\MusicStore.E2ETests\MusicStore.E2ETests.csproj...
  Restoring packages for F:\Developpements\temp\MusicStore\samples\MusicStore\MusicStore.csproj...
  Restoring packages for F:\Developpements\temp\MusicStore\test\MusicStore.E2ETests\MusicStore.E2ETests.csproj...
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Unable to load the service index for source https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json.\r [F:\Developpements\temp\MusicStore\MusicStore.sln]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error :   An error occurred while sending the request.\r [F:\Developpements\temp\MusicStore\MusicStore.sln]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error :   Failed to connect to server [F:\Developpements\temp\MusicStore\MusicStore.sln]

By nuget cli, everything happens correctly

@Xarkam would you be able to get a network trace of what is happening? Fiddler is a tool that can help with this.

Are you using any proxies?

Hello, I don't use any proxy.

I have installed fiddler and I test in next few days.

I have the unable to load the service issue as well.

C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Unable to load the service index for source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json.\r [C:\Users\Someusername\Source\Repos\Projectname\project.sln]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error :   Invalid length for a Base-64 char array or string. [C:\Users\Someusername\Source\Repos\Projectname\project.sln]

I guess the root cause is similar. But unlike Xarkam i am behind a corporate proxy, will try to test the connection via fiddler in a few days as well.

Hello,
I don't understand. Today, on my first pc, no problems found.
But, I will test to another pc with same problem.

@ununseptium @Xarkam Any updates on this?

Hello,
Since the update of nuget 1.0.3 to 1.0.4 it seems that the problem is no longer present.

I've tested on 2 pc.

image

same issue on mac and sdk 1.04

Hi Guys,
Followed the instruction provided by microsoft and it is all looks cool!! :)

  1. Install pre-requisites - Fixed my issues for the same
    https://www.microsoft.com/net/core#macos

Closing since most folks are unblocked.

@AliMd if you are still facing this issue then please give us a fiddler trace for investigation.

I do still see this error on two of our machine. Any help ?

Severity Code Description Project File Line Suppression State
Error NuGet Package restore failed for project XXXXX Unable to find version '6.0.4' of package 'Newtonsoft.Json'.
https://api.nuget.org/v3/index.json: Unable to load the service index for source https://api.nuget.org/v3/index.json.
Could not load type 'Newtonsoft.Json.Linq.JsonLoadSettings' from assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.
. Please see Error List window for detailed warnings and errors.

I have the same issue reported by vikas6681. I am using Windows 10 (OS Build 15036.966) with VS.Net 2017 (15.6.6)
"[nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json.
Could not load type 'Newtonsoft.Json.Linq.JsonLoadSettings' from assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'."

Any update team ? This is kinda blocking me from last 4 days.

Hey Kegor,

Thanks for inputs but we are trying to hit this API from India.

I am hitting the url from US.
I can get the url from the browser but not from VS.Net. It does not work in my laptop or the desktop.

Removing https://api.nuget.org/v3/index.json from packages\microsoft.dotnet.buildtools\2.1.0-preview3-02711-02\lib\init-tools.cmd, build, adding https://api.nuget.org/v3/index.json back, build, somehow seems to have fixed it for me.

I don't see this folder/file in my system as well as code

Same here guys

I can connect to Nuget from VS.Net 2015 but not VS.Net 2017
I tried to uninstall VS.Net 2017 and reinstall it, but it did not work.

I am having the same issue. I suspect it's something to do with being behind a proxy.
My Dockerfile is:

FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app

# Copy csproj and restore as distinct layers
COPY *.sln ./
RUN dotnet restore

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out

# Build runtime image
FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "salesorder.qry.webapiapp.dll"]

and I am getting an error on the step that publishes with dotnet:

$ docker build -t salesorder.qry.webapiapp .
Sending build context to Docker daemon  126.1MB
Step 1/10 : FROM microsoft/aspnetcore-build:2.0 AS build-env
 ---> 07590dec9c1e
Step 2/10 : WORKDIR /app
 ---> Using cache
 ---> 26007abaa8b5
Step 3/10 : COPY *.sln ./
 ---> Using cache
 ---> 69dc09df88f0
Step 4/10 : RUN dotnet restore
 ---> Using cache
 ---> 7c10e448f636
Step 5/10 : COPY . ./
 ---> Using cache
 ---> c588d98eb49b
Step 6/10 : RUN dotnet publish -c Release -o out
 ---> Running in 9492a4f61e38
Microsoft (R) Build Engine version 15.7.177.53362 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restoring packages for /app/SalesOrder.Cmd.Application.Model.Events/SalesOrder.Cmd.Application.Model.Events.csproj...
  Restoring packages for /app/SalesOrder.Cmd.Application.Model/SalesOrder.Cmd.Application.Model.csproj...
/usr/share/dotnet/sdk/2.1.200/NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/app/SalesOrder.Qry.sln]
/usr/share/dotnet/sdk/2.1.200/NuGet.targets(114,5): error :   An error occurred while sending the request. [/app/SalesOrder.Qry.sln]
/usr/share/dotnet/sdk/2.1.200/NuGet.targets(114,5): error :   SSL connect error [/app/SalesOrder.Qry.sln]
The command '/bin/sh -c dotnet publish -c Release -o out' returned a non-zero code: 1

However if I run the very same instruction directly I don't get that error:

$ dotnet publish -c Release -o out
Microsoft (R) Build Engine version 15.6.84.34536 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 43,43 ms for C:\src\SalesOrder.QueryService\SalesOrder.Cmd.Application.Model\SalesOrder.Cmd.Application.Model.csproj.
  Restore completed in 43,43 ms for C:\src\SalesOrder.QueryService\SalesOrder.Cmd.Application.Model.Events\SalesOrder.Cmd.Application.Model.Events.csproj.
  Restore completed in 4,67 ms for C:\src\SalesOrder.QueryService\SalesOrder.Qry.Infra.InMemoryRepository\SalesOrder.Qry.Infra.InMemoryRepository.csproj.
  Restore completed in 46,18 ms for C:\src\SalesOrder.QueryService\SalesOrder.Qry.Application.UnitTests\SalesOrder.Qry.Application.UnitTests.csproj.
  Restore completed in 51,08 ms for C:\src\SalesOrder.QueryService\SalesOrder.Qry.WebApi.UnitTests\SalesOrder.Qry.WebApi.UnitTests.csproj.
  Restore completed in 32,46 ms for C:\src\SalesOrder.QueryService\SalesOrder.Qry.WebApiApp\SalesOrder.Qry.WebApiApp.csproj.
  Restore completed in 12,53 ms for C:\src\SalesOrder.QueryService\ToolBelt.Hateoas\ToolBelt.Hateoas.csproj.
  Restore completed in 13,54 ms for C:\src\SalesOrder.QueryService\SalesOrder.Qry.WebApi\SalesOrder.Qry.WebApi.csproj.
  Restore completed in 2,16 ms for C:\src\SalesOrder.QueryService\ToolBelt.Mapping.Contracts\ToolBelt.Mapping.Contracts.csproj.
  Restore completed in 1,97 ms for C:\src\SalesOrder.QueryService\ToolBelt.Tests.Extensions\ToolBelt.Tests.Extensions.csproj.
  Restore completed in 55,52 ms for C:\src\SalesOrder.QueryService\SalesOrder.Qry.WebApiApp\SalesOrder.Qry.WebApiApp.csproj.
  Restore completed in 64,69 ms for C:\src\SalesOrder.QueryService\SalesOrder.Qry.Application.UnitTests\SalesOrder.Qry.Application.UnitTests.csproj.
  Restore completed in 2,36 ms for C:\src\SalesOrder.QueryService\SalesOrder.Qry.Domain.EventContracts\SalesOrder.Qry.Domain.EventContracts.csproj.
  Restore completed in 2,87 ms for C:\src\SalesOrder.QueryService\SalesOrder.Qry.Application\SalesOrder.Qry.Application.csproj.
  SalesOrder.Cmd.Application.Model -> C:\src\SalesOrder.QueryService\SalesOrder.Cmd.Application.Model\bin\Release\netstandard2.0\SalesOrder.Cmd.Application.Model.dll
  ToolBelt.Tests.Extensions -> C:\src\SalesOrder.QueryService\ToolBelt.Tests.Extensions\bin\Release\netstandard2.0\ToolBelt.Tests.Extensions.dll
  ToolBelt.Mapping.Contracts -> C:\src\SalesOrder.QueryService\ToolBelt.Mapping.Contracts\bin\Release\netstandard2.0\ToolBelt.Mapping.Contracts.dll
  ToolBelt.Tests.Extensions -> C:\src\SalesOrder.QueryService\ToolBelt.Tests.Extensions\out\
  ToolBelt.Mapping.Contracts -> C:\src\SalesOrder.QueryService\ToolBelt.Mapping.Contracts\out\
  SalesOrder.Cmd.Application.Model -> C:\src\SalesOrder.QueryService\SalesOrder.Cmd.Application.Model\out\
  ToolBelt.Hateoas -> C:\src\SalesOrder.QueryService\ToolBelt.Hateoas\bin\Release\netstandard2.0\ToolBelt.Hateoas.dll
  SalesOrder.Cmd.Application.Model.Events -> C:\src\SalesOrder.QueryService\SalesOrder.Cmd.Application.Model.Events\bin\Release\netstandard2.0\SalesOrder.Cmd.Application.Model.Events.dll
  SalesOrder.Cmd.Application.Model.Events -> C:\src\SalesOrder.QueryService\SalesOrder.Cmd.Application.Model.Events\out\
  ToolBelt.Hateoas -> C:\src\SalesOrder.QueryService\ToolBelt.Hateoas\out\
  SalesOrder.Qry.Application -> C:\src\SalesOrder.QueryService\SalesOrder.Qry.Application\bin\Release\netstandard2.0\SalesOrder.Qry.Application.dll
  SalesOrder.Qry.Domain.EventContracts -> C:\src\SalesOrder.QueryService\SalesOrder.Qry.Domain.EventContracts\bin\Release\netcoreapp2.0\SalesOrder.Qry.Domain.EventContracts.dll
  SalesOrder.Qry.Domain.EventContracts -> C:\src\SalesOrder.QueryService\SalesOrder.Qry.Domain.EventContracts\out\
  SalesOrder.Qry.Infra.InMemoryRepository -> C:\src\SalesOrder.QueryService\SalesOrder.Qry.Infra.InMemoryRepository\bin\Release\netcoreapp2.0\SalesOrder.Qry.Infra.InMemoryRepository.dll
  SalesOrder.Qry.WebApi -> C:\src\SalesOrder.QueryService\SalesOrder.Qry.WebApi\bin\Release\netstandard2.0\SalesOrder.Qry.WebApi.dll
  SalesOrder.Qry.Application -> C:\src\SalesOrder.QueryService\SalesOrder.Qry.Application\out\
  SalesOrder.Qry.Application.UnitTests -> C:\src\SalesOrder.QueryService\SalesOrder.Qry.Application.UnitTests\bin\Release\netcoreapp2.0\SalesOrder.Qry.Application.UnitTests.dll
  SalesOrder.Qry.Application.UnitTests -> C:\src\SalesOrder.QueryService\SalesOrder.Qry.Application.UnitTests\out\
  SalesOrder.Qry.Infra.InMemoryRepository -> C:\src\SalesOrder.QueryService\SalesOrder.Qry.Infra.InMemoryRepository\out\
  SalesOrder.Qry.WebApi -> C:\src\SalesOrder.QueryService\SalesOrder.Qry.WebApi\out\
  SalesOrder.Qry.WebApiApp -> C:\src\SalesOrder.QueryService\SalesOrder.Qry.WebApiApp\bin\Release\netcoreapp2.0\SalesOrder.Qry.WebApiApp.dll
  SalesOrder.Qry.WebApiApp -> C:\src\SalesOrder.QueryService\SalesOrder.Qry.WebApiApp\out\
  SalesOrder.Qry.WebApi.UnitTests -> C:\src\SalesOrder.QueryService\SalesOrder.Qry.WebApi.UnitTests\bin\Release\netcoreapp2.0\SalesOrder.Qry.WebApi.UnitTests.dll
  SalesOrder.Qry.WebApi.UnitTests -> C:\src\SalesOrder.QueryService\SalesOrder.Qry.WebApi.UnitTests\out\

How's that possible?

I've tried to add the following proxy settings in NuGet.Config
C:\Users\iberodev\AppData\Roaming\NuGet\NuGet.Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!-- other things here -->
  <config>
        <add key="https_proxy" value="https://username@[email protected]:8080" />
  </config>
</configuration>

No luck. Same result. I'm really stuck with this and I cannot find good answers anywhere. Any advice would be much appreciated

The same problem. When i use "RUN dotnet restore --disable-parallel" in dockerfile all works fine, but without "--disable-parallel" it doesnt work.

**Docker version** 18.03.1-ce, build 9ee9f40

**dotnet --info**
Product Information:
 Version:            2.1.200
 Commit SHA-1 hash:  2edba8d7f1

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.200\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.7
  Build    : 2d61d0b043915bc948ebf98836fefe9ba942be11

having same problem within docker container

C:\Program Files\dotnet\sdk\2.1.300\NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json.

--disable-parallel didn't help

Had same problem with my Teamcity agent working with Docker-in-Docker option, and exposing port 80 on agent container did the trick (not sure why though).

Facing same issue within docker container.

try to run docker build with --network=host

Exact same issue here with .NET Core 2.1 but only when accessing my private NuGet server.

Error:

/src/ITAM.ApiGateway/ITAM.ApiGateway.csproj" (Restore target) (1) ->
(Restore target) ->
/usr/share/dotnet/sdk/2.1.300/NuGet.targets(114,5): error : Unable to load the service index for source http://localhost/packageserver/nuget. [/src/ITAM.ApiGateway/ITAM.ApiGateway.csproj]

/usr/share/dotnet/sdk/2.1.300/NuGet.targets(114,5): error : Cannot assign requested address [/src/ITAM.ApiGateway/ITAM.ApiGateway.csproj]

NuGet.Config


















image
I'm getting the same issues unless I run dotnet restore as root on my linux server. I recently installed the 2.1 SDK and currently have SDKs 2.0 and 2.1 installed.

I did not use to have this problem when only SDK 2.0 was installed. I'm wondering if there's some permissions issue now with the new SDK installation?

Hmmm interesting is that after setting http_proxy directly into c:\Users\<user>\AppData\Roaming\NuGet\NuGet.Config it started working, but setting http_proxy to local Nuget.Config which is in project it was not working.

Problem occured only after installing .net core SDK 2.1, before this i was able to work without http_proxy

tagging @rrelyea for visibility.

sudo chmod +r /etc/pki/tls/certs/* solved the problem for me.

Make sure the docker container has internet access during build.
You can check /etc/resolv.conf in the container if the correct proxy is present.

In order to set the default DNS nameservers in this resolv.conf file use one of the options below:

  1. Make sure to provide the proxy / nameservers in a (new) file /etc/docker/daemon.json on the host running the docker daemon like this: {"dns": ["10.10.10.10", "10.10.10.20"] }

  2. Add a line to the following file on the docker host: /etc/default/docker >> DOCKER_OPTS="--dns 10.10.10.10 --dns 10.10.10.20"

NetCore team believes this is bug in NetCore 2.1 runtime. (new networking code in 2.1)

See https://github.com/dotnet/corefx/issues/30354

Finally found a solution to it.
By default VS.Net uses Newtonsoft.Json version 7 and it does not have Newtonsoft.Json.Linq.JsonLoadSettings class
Close all instances of Vs.net 2017
Download the latest version of Newtonsoft.Json (currently its 11) from http://nuget.org and rename it to .zip, extract the files, gacutil the Newtonsoft.Json.dll from net45 folder.
Edit machine.configs
32-bit - C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config
64-bit - C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config - this is optional but for consistency.

change version in these tags

      <qualifyAssembly partialName="Newtonsoft.Json" fullName="Newtonsoft.Json, Version=**11.0.0.0**, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" />
  <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="1.0.0.0-100.0.0.0" newVersion="11.0.0.0" />
  </dependentAssembly>

Open vs.net 2017 and it should now will be able connect to Nuget.org

Finally, after spending my entire Saturday, I was able to fix the same. You may see my answer in StackOverflow (https://stackoverflow.com/questions/41185443/nuget-connection-attempt-failed-unable-to-load-the-service-index-for-source/51456498#51456498) to know further. I am still analyzing the issue though.

Dotnet restore command failed when i tried to build the dotnetcore app using below docker file. Can someone provide your thoughts on this?

-> I am using Ubuntu image 16.04 running in my VM.
-> My sample docker image:
FROM microsoft/dotnet:2.0-sdk
COPY . /app
WORKDIR /app
RUN mkdir /app/logs
RUN chmod -R a+rwx /app/logs

RUN dotnet restore
RUN ["dotnet", "build"]

EXPOSE 5000/tcp
ENV ASPNETCORE_URLS http://*:5000

ENTRYPOINT ["dotnet", "run"]

image

-> My runtime env details below:
image

Hi Team,

Found the error - Unable to load the service index for source https://api.nuget.org/v3/index.json. [/app/mvcapp.csproj]

I am using the below dockerfile to build the sample dotnetcore application which uses dotnetcore ver 2.1.403 as runtime version. Can someone help me on how to resolve this error wothout usng thenetwork proxy in my Ubuntu VM 18.04 lts.

-> My Docker file below:
FROM microsoft/dotnet:2.1-sdk
COPY . /app
WORKDIR /app

RUN dotnet restore
RUN dotnet build

ENV CORECLR_PROFILER="{57e1aa68-2229-41aa-9931-a6e93bbc64d8}"
ENV CORECLR_ENABLE_PROFLING=1
ENV CORECLR_PROFILER_PATH="/root/.nuget/packages/appdynamics.agentsdk/4.5.2/runtimes/linux-x64/native/libappdprofiler.so"

EXPOSE 5000/tcp
ENV ASPNETCORE_URLS https://*:5000

ENTRYPOINT ["dotnet","run"]

-> Error log details:
Sending build context to Docker daemon 10.78MB
Step 1/11 : FROM microsoft/dotnet:2.1-sdk
---> 6baac5bd0ea2
Step 2/11 : COPY . /app
---> 3eeae5a07ee9
Step 3/11 : WORKDIR /app
Removing intermediate container 930a3bdf049d
---> 22a34040bb36
Step 4/11 : RUN dotnet restore
---> Running in 0dc7c6cf45b7
Restoring packages for /app/mvcapp.csproj...
/usr/share/dotnet/sdk/2.1.403/NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/app/mvcapp.csproj]
/usr/share/dotnet/sdk/2.1.403/NuGet.targets(114,5): error : Resource temporarily unavailable [/app/mvcapp.csproj]
The command '/bin/sh -c dotnet restore' returned a non-zero code: 1

My mvcapp.csproj file details attached in screenshot below:

screenshot from 2018-11-01 17-39-56

@praveenvarmaN , I have the same problem. Did you resolve it?

I have the same problem. Did anyone resolve it? It seems dotnet restore from docker build is not using the proxy settings for docker daemon.

Restarting docker on my windows system resolved it for me.

@praveenvarmaN , I have the same problem. Did you resolve it?

No. I need to understand why the proxy setup is required when you run the dotnet restore via dockerfile for building the docker image for aspdotnetcore apps. Anywayz, you will be using the wired connection in ubuntu server vm. have my docker engine installed and running.

Any thoughts on this?

Restarting docker on my windows system resolved it for me.

I am having same issue now. It worked on Sunday (2 days ago) but suddenly throwing error now.

Anyone can help me?

[Details]
I have .net core 2.0 based application that is deployed on AWS ECS through Visual Studio AWS Toolkit.
Everything worked without any issues in the past, but today when I tried to deploy updates to AWS, it is failing at docker build (dotnet restore step) throwing the above error message.

Restarting docker on my windows system resolved it for me.

It didn't work for me ...

It didn't work for me ...on Linux

Upgrading dot net package from 2.08 to 2.09 resolved this issue.

export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0
dotnet restore

this worked for me

Upgrading dot net package from 2.08 to 2.09 resolved this issue.

Can you please share your docker file to compare and what .net package version Microsoft.AspNetCore.All and Microsoft.NETCore.App ?

try to run docker build with --network=host

thanks. 3 hours missed with my fault.. if no network, no restore...

Restarting docker on my windows system resolved it for me.

This was solving the issue for me as well. Also docker login to ACR is now working.

If in Linux, I was able to get restore working on my Solus box by first running
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0. Once I did that, dotnet restore worked.

export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 
dotnet restore

Same symtoms here, building a AspNetCore 2.2 App with docker.

Restarting Docker (Version 2.0.0.3 (31259) helps for me (like for a few other problems with docker after machine restart - outside from aspnetcore).... => problem caused by docker not by dotnet/nuget etc!

BUT: reading this issue here was really helpful!

Restart didn't work for me, I'm using osx 10.14.5 :(

Sad but true: nobody seems to be able to figure this show-stopper out. It has caused us to currently drop the entire windows-stack-container-approach and move to iot-edge on linux containers just so we can make some progress. We have tried all the "tricks" mentioned above. none of them work in our case, so not the root cause. Where I draw the line though is attempting to de-install and re-install things at random to see if a "shot in the dark" fixes it. I'm still suspecting Docker on windows but no proof. We are using the newest iot-edge Docker-Windows.

I had the same issue that multiple others had. Trying a nuget restore in a Docker image build. For whatever reason, while I could resolve api.nuget.org in a shell on a container from that image, it wasn't working when building the image. Adding this to the script launched from my Dockerfile did the trick:

echo 152.199.4.33 api.nuget.org >> C:\Windows\System32\drivers\etc\hosts

I had a similar problem, and fixed it by adding "dns": ["8.8.8.8"] to the daemon.json. When I used a shell from a running container, I could ping IP addresses, but couldn't resolve dns names. For example, ping 8.8.8.8" would work just fine, but ping google.com would fail. I couldn't resolve hostnames, so couldn't find api.nuget.org to restore nuget packages.

On further exploration, Resolve-DnsName google.com would fail while Resolve-DnsName google.com -Server 8.8.8.8 would succeed. For whatever reason, the container did not have a default DNS server configured. An ipconfig /all confirmed that no DNS server was known by the container.

To fix this, I added "dns": ["8.8.8.8"] to the daemon configuration file to force the daemon to add a DNS server. The documentation says that if no DNS server is specified, 8.8.8.8 will be added by default, but in my case that did not appear to be happening. Hopefully, someone can get to the bottom of why this is the problem or whether the problem is something more general.

I encountered this error when build my project with a library in NuGet. Setting the proxy in terminal works for me.
set http_proxy=my.proxy.com:80
set https_proxy=my.proxy.com:80

I added the source address of my NuGet packages in the nuget.config file of my project and I still get the error "Unable to load the service index for source http: // myServer: 8080 / tfs / TPC__MyProject / _packaging / MyNuget / nuget /v3/index.json ", what do you recommend me to do in this case? The package sources section looks like this:
image

I had a similar problem, and fixed it by adding "dns": ["8.8.8.8"] to the daemon.json

This is what fixed that for me. I was testing my network from container by pinging 8.8.8.8 and was totally sure that it's ok. But as i saw this and tried to ping google.com - it wasn't resolved.

I was able to fix this problem by removing the .nuget directory from my %USERPROFILE% (AKA $HOME) directory, as mentioned here: https://github.com/NuGet/Home/issues/2880#issuecomment-332247920

If you are having this error in a docker container then run

  • docker system prune --volumes.

Then stop the docker app in your machine.
Restart your machine and running everything from start.

* docker system prune --volumes.

This worked for me, but seems a bit heavy handed. Before executing it gives this warning:

WARNING! This will remove:

  • all stopped containers
  • all networks not used by at least one container
  • all volumes not used by at least one container
  • all dangling images
  • all dangling build cache

This smells like a cache problem. Is nuget using a cache that I can clear? Could we use this:
dotnet nuget locals --clear all

I fixed it before using the prune solution. Then it broke again. Then I used the prune solution to fix it again. Now I have to wait until I run into it again before attempting the --clear all solution.

I tried using the

  • docker system prune
    but it did not worked.

Yes even I think that this is a cache problem.

I ran into the same problem this morning, and here is a new datapoint. I was able to fix the problem by removing and creating my network.

docker network rm <my network name>
docker network create <my network name>

I cannot imagine why this worked, but it was one of the things that is removed during the system purge. I'll report back wheather this is a consistent fix, or if I figure out why it worked.

The above solution worked when launching from docker directly, but then when I try to do docker-compose up, I get this:

ERROR: for basicservice_pomodoro-pgsql_1  Cannot start service pomodoro-pgsql: network 108e8267563fc4bb2ee6af201c0d3e2b95d4717a7d5cb3c9b5620ee751fc3fcc not found

Something in the docker-compose ecosystem may be causing the caching problem even when launching from docker directly. Easily fixed:

docker-compose rm
docker-compose up

Looking at docker-compose up help, I think I may be able to fix it with either --force-recreate and/or --renew-anon-volumes. I'll have to wait until the next time the problem occurs to find out.

I really would like this fixed. Just to help anybody else that came across this issue, here's what I did:

There's a file at the path C:\ProgramData\Docker\config\daemon.json. Add the line: "dns": ["8.8.8.8"] in the JSON object.

Ideally, replace it with your actual DNS server. 8.8.8.8 is just a well known DNS server, so it should work.

After adding that line, restart the Docker daemon. You can use the context menu from the system tray for that.

I hope this helps somebody.

I had the same problem (Docker on Linux) and fixed it by enabling host networking, i.e.
docker run --network host mcr.microsoft.com/dotnet/core/sdk:2.1

Docker image:
docker inspect --format='{{.Id}}' mcr.microsoft.com/dotnet/core/sdk:2.1 => sha256:156e5cc5d7a3aaf4166d17f1e0b3a3c262a22caf8efac9b855ba1782ef98071c

The container would actually work on my local Linux machine, but on Jenkins (also Linux) it would fail. Very strange.

Mine is
C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\5.0.100\NuGet.targets(131,5): error : Unable to load the service index for source https://dotnet.myget.org/F/roslyn/api/v3/index.json. [D:\a\Sdk\Sdk\build_all_packages.sln] C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\5.0.100\NuGet.targets(131,5): error : Response status code does not indicate success: 404 (Feed does not exist.). [D:\a\Sdk\Sdk\build_all_packages.sln]

from inside of Github Actions.

@AraHaan the "dotnet" account at myget (dotnet.myget.org) has been deleted. I suggest using versions of packages available on nuget.org.

@zivkan I see, however I usually use the prerelease packages to .NET core assemblies in order to be able to pull in the latest and greatest fixes to them (like for example System.Text.Json from .NET 5 / 6) and using it on netcoreapp3.1.

I do this to then be able to ease up porting to .NET 5 / 6 easier once all of the dependencies get greenlit on the support of .NET 5 / 6.

Was this page helpful?
0 / 5 - 0 ratings