栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

dotnet restore出现SSL错误的解决方案

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

dotnet restore出现SSL错误的解决方案

我的博客

博客链接

错误场景

当我把.net core webpai项目部署到centos上后,使用dotnet restore命令还原时,出现如下错误:

/usr/share/dotnet/sdk/5.0.404/NuGet.targets(131,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/root/stickynotesbackend/CloudWorking/CloudWorkingBackend/CloudWorkingBackend.sln]
/usr/share/dotnet/sdk/5.0.404/NuGet.targets(131,5): error :   The SSL connection could not be established, see inner exception. [/root/stickynotesbackend/CloudWorking/CloudWorkingBackend/CloudWorkingBackend.sln]
/usr/share/dotnet/sdk/5.0.404/NuGet.targets(131,5): error :   The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot [/root/stickynotesbackend/CloudWorking/CloudWorkingBackend/CloudWorkingBackend.sln]

实际上在出现这个错误的时候是因为我在jenkins里面用dotnet restore命令时报出来的,坑爹的花了我3个小时才解决

错误原因

大概原因是https证书找不到,所以没有权限调接口拉数据下来

解决方案

查询openssl的路径:

openssl version -a		

然后将 CentOS 默认的 openssl CA 证书拷贝到 OPENSSLDIR

cp /etc/pki/tls/cert.pem /usr/local/openssl/

然后再次运行dotnet restore:

其他解决方案

实际上上面的解决方案是我找了3个小时左右最后才成功的,如果试过了还不行,可以参考下面的这些博客或链接的思路:

    博客1

    微软官方的方案,注意系统是windows还是linux(ubuntu、centos不是一样的,注意)

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/728758.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号