NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

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

Open livarcocc opened 7 years ago

livarcocc commented 7 years ago

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

mishra14 commented 7 years ago

@emgarten

emgarten commented 7 years ago

@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.

Xarkam commented 7 years ago

@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.

Xarkam commented 7 years ago

@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

emgarten commented 7 years ago

@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?

Xarkam commented 7 years ago

Hello, I don't use any proxy.

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

nevotheless commented 7 years ago

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.

Xarkam commented 7 years ago

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

emgarten commented 7 years ago

@ununseptium @Xarkam Any updates on this?

Xarkam commented 7 years ago

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

AliMD commented 7 years ago

same issue on mac and sdk 1.04

ashish005 commented 7 years ago

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
mishra14 commented 6 years ago

Closing since most folks are unblocked.

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

vikas6681 commented 6 years ago

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.

gidduk commented 6 years ago

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'."

vikas6681 commented 6 years ago

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

vikas6681 commented 6 years ago

Hey Kegor,

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

gidduk commented 6 years ago

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.

kdg3737 commented 6 years ago

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.

vikas6681 commented 6 years ago

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

gatsbys commented 6 years ago

Same here guys

gidduk commented 6 years ago

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.

iberodev commented 6 years ago

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@mypass@sampleproxy.com: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

novicov commented 6 years ago

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
Bartmax commented 6 years ago

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

Hubert-Rybak commented 6 years ago

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).

bjorkstromm commented 6 years ago

Facing same issue within docker container.

Hubert-Rybak commented 6 years ago

try to run docker build with --network=host

CyberBizSoft commented 6 years ago

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

<?xml version="1.0" encoding="utf-8"?>

delebru commented 6 years ago

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?

kukjevov commented 6 years ago

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

mishra14 commented 6 years ago

tagging @rrelyea for visibility.

delebru commented 6 years ago

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

jsnet-ops commented 6 years ago

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"

rrelyea commented 6 years ago

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

gidduk commented 6 years ago

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

SibeeshVenu commented 6 years ago

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.

praveenvarmaN commented 6 years ago

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

praveenvarmaN commented 6 years ago

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

praveenvarmaN commented 6 years ago

My mvcapp.csproj file details attached in screenshot below:

praveenvarmaN commented 6 years ago

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

geedsen commented 6 years ago

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

mayureshs commented 6 years ago

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.

geedsen commented 6 years ago

Restarting docker on my windows system resolved it for me.

praveenvarmaN commented 6 years ago

@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?

yuefengkai commented 5 years ago

Restarting docker on my windows system resolved it for me.

ThunderBoltEngineer commented 5 years ago

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.

ThunderBoltEngineer commented 5 years ago

Restarting docker on my windows system resolved it for me.

It didn't work for me ...

RockNHawk commented 5 years ago

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

ThunderBoltEngineer commented 5 years ago

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