.NET Core添加程序包-无效的证书

我正在使用WSL Ubuntu,对于某些站点,包括NuGet,它没有完整的证书链。

结果,我无法从NuGet添加或还原软件包。有办法绕过它吗?

示例:

dotnet restore

出现以下错误:

/usr/share/dotnet/sdk/3.0.100/NuGet.targets(123,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/home/pomatti/Projects/dojo-for-net/solutions/WhiteBelt/WhiteBelt.sln]
/usr/share/dotnet/sdk/3.0.100/NuGet.targets(123,5): error :   The SSL connection could not be established,see inner exception. [/home/pomatti/Projects/dojo-for-net/solutions/WhiteBelt/WhiteBelt.sln]
/usr/share/dotnet/sdk/3.0.100/NuGet.targets(123,5): error :   The remote certificate is invalid according to the validation procedure. [/home/pomatti/Projects/dojo-for-net/solutions/WhiteBelt/WhiteBelt.sln]

更新

我尝试将所有证书手动添加到Ubuntu,但这没有用:

  1. 已将巴尔的摩,microsoft和NuGet证书复制到/usr/local/share/ca-certificate
  2. 已执行sudo update-ca-certificates

遇到相同的错误。

msgl88 回答:.NET Core添加程序包-无效的证书

我在公司环境中,遇到了相同的错误。最终,我找到了解决方案。

最初,我尝试将根CA证书复制到上述路径中,但是,当我运行命令update-ca-certificates时,我在输出中发现它正在寻找路径protected $casts = [ 'item_details.picture' => 'array',]; 而不是路径/etc/ssl/certs/

在将证书处理到该文件夹​​和/usr/local/share/ca-certificate之后就可以解决。

祝你好运。

,

对于遇到此问题的任何人,都无法绕过证书验证。

由于某些原因,我的Ubuntu应用程序出现了问题。我已经重新安装它来解决问题。

https://github.com/microsoft/WSL/issues/4666

本文链接:https://www.f2er.com/3127490.html

大家都在问