简体   繁体   English

无法加载源 https://pkgs.dev.azure.com/xxxxx/_packaging/yyyyy/nuget/v3/index.Z466DEEC76ECDF246D38571FZ6 的服务索引

[英]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 .我收到此错误:无法加载源https://pkgs.dev.azure.com/xxxxx/_packaging/xxxxx/nuget/v3/index.Z466DEEC76ECDF5FCA6D348571的服务索引。 Response status code does not indicate success: 401 (Unauthorized).)响应状态码不表示成功:401(未授权)。)

i am trying to restore package from an azure artifact of other organisation.我正在尝试从其他组织的 azure 工件中恢复 package。 enter image description here在此处输入图像描述

error log: 38 package(s) to packages.config projects错误日志:38 个包到 packages.config 项目

[error]The nuget command failed with exit code(1) and error(Errors in packages.config projects [错误]nuget 命令失败,退出代码(1)和错误(packages.config 项目中的错误

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我尝试了这些解决方案,但没有运气: 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来自 github 用户@danilobreda

Below is the answer from the link above:以下是上面链接的答案:


What worked for me... using the PAT token.什么对我有用……使用 PAT 令牌。

My dockerfile:我的 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:和我的 NuGet.Config 文件:

<?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.需要传递用户名参数,但您可以在那里设置随机用户名/短语...因为 PAT 没有用户名参数。 Make sure that the nuget package have permissions (read and write) of PAT owner.确保 nuget package 具有 PAT 所有者的权限(读取和写入)。

Re-entering account credentials in VS worked for me.在 VS 中重新输入帐户凭据对我有用。

Repair Visual Studio installation worked for me.修复 Visual Studio 安装对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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