简体   繁体   中英

Unable to load the service index for source https://pkgs.dev.azure.com/xxxxx/_packaging/yyyyy/nuget/v3/index.json

I an getting this error:Unable to load the service index for source https://pkgs.dev.azure.com/xxxxx/_packaging/xxxxx/nuget/v3/index.json . Response status code does not indicate success: 401 (Unauthorized).)

i am trying to restore package from an azure artifact of other organisation. enter image description here

error log: 38 package(s) to packages.config projects

[error]The nuget command failed with exit code(1) and error(Errors in packages.config projects

Unable to find version '1.0.976930' of package 'xxxx.Security.Eso.Web.DevSignOn'.
  https://api.nuget.org/v3/index.json: Package 'xxxx.Security.Eso.Web.DevSignOn.1.0.976930' is not found on source 'https://api.nuget.org/v3/index.json'.
  https://pkgs.dev.azure.com/xxxx/_packaging/yyyy/nuget/v3/index.json: Unable to load the service index for source https://pkgs.dev.azure.com/xxxx/_packaging/yyyy/nuget/v3/index.json.
  Response status code does not indicate success: 401 (Unauthorized).)

[error]Packages failed to restore

i tried these solutions but no luck: 1. https://mallibone.com/post/private-nuget-feed-azure-devops 2. https://docs.microsoft.com/en-us/azure/devops/pipelines/packages/nuget-restore?view=azure-devops

this worked for me, link . From github user @danilobreda

Below is the answer from the link above:


What worked for me... using the PAT token.

My dockerfile:

FROM microsoft/aspnetcore-build:latest AS build
WORKDIR /src
COPY . .
COPY NuGet.Config ./
RUN dir
RUN dotnet restore --configfile NuGet.Config -nowarn:msb3202,nu1503 --verbosity diag
RUN dotnet publish --output /output --configuration Release

FROM microsoft/aspnetcore:latest
WORKDIR /app
COPY --from=build /output /app
ENTRYPOINT ["dotnet", "DockerProject.dll"]

and my NuGet.Config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="BredasVSTS" value="https://xxxx.pkgs.visualstudio.com/_packaging/BredasVSTS/nuget/v3/index.json" />
  </packageSources>
  <packageSourceCredentials>
    <BredasVSTS>
      <add key="Username" value="emailhere" />      
      <add key="ClearTextPassword" value="PAT here" />
    </BredasVSTS>
  </packageSourceCredentials>
</configuration>

The Username parameter need to be passed but you can set a random username/phrase there... since PAT does not have username parameter. Make sure that the nuget package have permissions (read and write) of PAT owner.

Re-entering account credentials in VS worked for me.

Repair Visual Studio installation worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM