首页 > 解决方案 > 在 dotnet 命令行中出现 SSL 错误

问题描述

从今天早上我就收到了这个问题。我不再能够从 dotnet 命令行恢复/构建/添加包。

我收到以下错误:

» dotnet build
Microsoft (R) Build Engine version 15.7.179.6572 pour .NET Core
Copyright (C) Microsoft Corporation. Tous droits réservés.

  Restauration des packages pour /home/ebernard/Documents/python/test_dotnet_console/retard-cli/retard-cli.csproj...
/usr/share/dotnet/sdk/2.1.301/NuGet.targets(114,5): error : Impossible de charger l'index de service pour la source https://api.nuget.org/v3/index.json. [/home/ebernard/Documents/python/test_dotnet_console/retard-cli/retard-cli.csproj]
/usr/share/dotnet/sdk/2.1.301/NuGet.targets(114,5): error :   The SSL connection could not be established, see inner exception. [/home/ebernard/Documents/python/test_dotnet_console/retard-cli/retard-cli.csproj]
/usr/share/dotnet/sdk/2.1.301/NuGet.targets(114,5): error :   error:2006D080:BIO routines:BIO_new_file:no such file [/home/ebernard/Documents/python/test_dotnet_console/retard-cli/retard-cli.csproj]

ÉCHEC de la build.

/usr/share/dotnet/sdk/2.1.301/NuGet.targets(114,5): error : Impossible de charger l'index de service pour la source https://api.nuget.org/v3/index.json. [/home/ebernard/Documents/python/test_dotnet_console/retard-cli/retard-cli.csproj]
/usr/share/dotnet/sdk/2.1.301/NuGet.targets(114,5): error :   The SSL connection could not be established, see inner exception. [/home/ebernard/Documents/python/test_dotnet_console/retard-cli/retard-cli.csproj]
/usr/share/dotnet/sdk/2.1.301/NuGet.targets(114,5): error :   error:2006D080:BIO routines:BIO_new_file:no such file [/home/ebernard/Documents/python/test_dotnet_console/retard-cli/retard-cli.csproj]
    0 Avertissement(s)
    1 Erreur(s)

Temps écoulé 00:00:01.53

这显然是 ssl 的问题,但我无法修复它。我尝试重新安装 dotnet-sdk、openssl,它没有任何改变。

你知道这可能来自哪里吗?

编辑:我在 Ubuntu 16.04

编辑 2:我dotnet build从 Docker 内部尝试,它可以工作,所以我认为问题来自我的安装。

标签: .netsslopenssl.net-core

解决方案


我发现了问题,它来自丢失的证书。

在我的/etc/ssl/certs中,我有一个指向丢失证书 ( 0c31d5ce -> ssl-cert-snakeoil.pem) 的死链接。

我使用以下命令重新创建丢失的证书,并且一切正常。

sudo make-ssl-cert generate-default-snakeoil --force-overwrite

推荐阅读