【发布时间】:2022-01-07 18:10:37
【问题描述】:
我尝试在 Ubuntu 20.04 虚拟机上构建一个 .net core 3.1 项目。
项目构建成功,我现在需要更新项目中的一个 NuGet 包。一旦我将 .csproj 文件中的包版本更改为所需版本,当我构建或执行“dotnet restore”时,我会收到以下消息:
/usr/share/dotnet/sdk/3.1.415/NuGet.targets(128,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/home/ic/Source/redacted.csproj]
/usr/share/dotnet/sdk/3.1.415/NuGet.targets(128,5): error : The SSL connection could not be established, see inner exception. [/home/ic/Source/redacted.csproj]
/usr/share/dotnet/sdk/3.1.415/NuGet.targets(128,5): error : The remote certificate is invalid according to the validation procedure. [/home/ic/Source/redacted.csproj]
如果我浏览到https://api.nuget.org/v3/index.json,我可以在浏览器中成功查看json,并且证书似乎是受信任的。
我有:
- 更新的软件包(apt-get update 和 apt-get upgrade)
- 更新了 NuGet
- 根据此问题中的更新在 NuGet.Config 中设置证书缩略图:Problem resolving Nuget Packages in Devops Build Agent due to Certificate issues
- 我可以在 Ubuntu 上的受信任证书中看到 nuget.org 的 DigiCert 根证书
【问题讨论】:
-
你用的是什么浏览器?例如,Firefox 有自己的证书存储。此外,根证书可能有效,而叶证书无效 - 这对于 api.nuget.org 仍然很奇怪。
-
Edge、Chrome 和 Firefox(都在 Ubuntu 中)都报告证书正常。
标签: c# .net ssl nuget ubuntu-20.04