无法加载源https://api.nuget.org/v3/index.json的服务索引。 [C:\app\aspnetapp.csproj]

编程入门 行业动态 更新时间:2024-10-23 11:31:41
本文介绍了无法加载源api.nuget/v3/index.json的服务索引。 [C:\app\aspnetapp.csproj]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

github/dotnet/dotnet-docker-样本/树/主/ aspnetapp

Docker命令 docker build -t aspnetapp 。

我在docker build命令中遇到错误

I am getting an error for docker build command as

C:\Program Files \dotnet\sdk\2.1.105\NuGet.targets(104,5):错误:无法加载源 api.nuget/v3/index.json 。 [C:\app\aspnetapp.csproj]

C:\Program Files\dotnet\sdk\2.1.105\NuGet.targets(104,5): error : Unable to load the service index for source api.nuget/v3/index.json. [C:\app\aspnetapp.csproj]

[1]PS C:\Users\pssharma\dotnet-docker-samples\aspnetapp> docker build -t aspnetapp . Sending build context to Docker daemon 2.444MB Step 1/10 : FROM microsoft/aspnetcore-build:2.0 AS build-env ---> eb21d939e0d8 Step 2/10 : WORKDIR /app ---> Using cache ---> d4ec30216ed7 Step 3/10 : COPY *.csproj ./ ---> Using cache ---> 2ff39b5e6cb4 Step 4/10 : RUN dotnet restore ---> Running in 776764a35311 Restoring packages for C:\app\aspnetapp.csproj... Restoring packages for C:\app\aspnetapp.csproj... C:\Program Files\dotnet\sdk\2.1.105\NuGet.targets(104,5): error : Unable to load the service index for source api.nuget/v3/index.json. [C:\app\asp C:\Program Files\dotnet\sdk\2.1.105\NuGet.targets(104,5): error : An error occurred while sending the request. [C:\app\aspnetapp.csproj] C:\Program Files\dotnet\sdk\2.1.105\NuGet.targets(104,5): error : The operation timed out [C:\app\aspnetapp.csproj]

以下命令返回了非零代码:1

The following command returned a non-zero code: 1

powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; dotnet restore

推荐答案

对我来说,此问题是随机出现的(以及多个类似的问题,例如如为nuget拒绝权限等。要解决此问题,请重新启动Visual Studio)对于 windows ,已通过重新启动docker服务并重新启动Visual Studio(2017)进行了修复。

For me, this issue appeared randomly (along with multiple similar issues, such as "permission denied for nuget" etc. To fix that, restart Visual Studio) For windows, it was fixed by restarting docker service and restarting Visual Studio (2017).

  • 关闭Docker和Visual Studio
  • Winkey + R,键入services.msc
  • 找到适用于Windows Service的Docker并重新启动它(通常仅重启Docker是不够的)
  • 启动Docker和Visual Studio
  • Shut down Docker and Visual Studio
  • Winkey + R, type in services.msc
  • Find Docker for Windows Service and restart it (restarting Docker normally is not enough)
  • Start Docker and Visual Studio
  • 更多推荐

    无法加载源https://api.nuget.org/v3/index.json的服务索引。 [C:\app\aspnetapp.csproj]

    本文发布于:2023-11-02 14:53:47,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1552693.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:索引   加载   nuget   org   api

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!