尝试 dotnet 恢复时出现 NuGet 错误 NU1301

问题描述 投票:0回答:1

当尝试执行“dotnet 恢复”(在 docker build 命令内)时,出现以下错误:

 > [build 4/5] RUN dotnet restore:
0.994   Determining projects to restore...
8.298 /app/MudBlazorCICDTest.csproj : error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json. [/app/MudBlazorCICDTest.sln]
14.06 /usr/share/dotnet/sdk/8.0.101/NuGet.targets(156,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/app/MudBlazorCICDTest.sln]
14.06 /usr/share/dotnet/sdk/8.0.101/NuGet.targets(156,5): error :   The SSL connection could not be established, see inner exception. [/app/MudBlazorCICDTest.sln]
14.06 /usr/share/dotnet/sdk/8.0.101/NuGet.targets(156,5): error :   The remote certificate is invalid because of errors in the certificate chain: PartialChain [/app/MudBlazorCICDTest.sln]

如果我将给定的 URL (https://api.nuget.org/v3/index.json) 复制并粘贴到浏览器(在本例中为 Chrome)中,它就可以工作。 所以理论上我应该能够到达该站点。

我尝试将 MudBlazor-Project 发布为 docker 映像。 Dockerfile 包含以下内容:

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app

COPY . ./

RUN dotnet restore
RUN dotnet publish -c Release -o out

FROM nginx:1.25.3
WORKDIR /app

EXPOSE 8080

COPY nginx.conf /etc/nginx/nginx.conf
COPY --from=build /app/out/wwwroot /usr/share/nginx/html

如有任何帮助,我们将不胜感激!

.net nuget
1个回答
0
投票

我们的防火墙管理员必须更改设置。 该地址被防火墙阻止了。

© www.soinside.com 2019 - 2024. All rights reserved.