在dotnet命令行中获取SSL错误

时间:2018-07-05 11:48:28

标签: .net ssl openssl .net-core

从今天早上开始,我得到了这个问题。 我再也无法从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:我在Docker内部尝试dotnet build,它可以正常工作,所以我认为问题来自我的安装。

1 个答案:

答案 0 :(得分:0)

我发现了问题,原因是证书丢失。

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

我使用以下命令重新创建丢失的证书,然后一切恢复正常。

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