我在CentOS上安装了dotnet核心,还有一个使用JWT的项目
https://www.nuget.org/packages/JWT/3.1.1
我的OSX本地恢复效果非常好:
dotnet --info
.NET Command Line Tools (2.0.3)
Product Information:
Version: 2.0.3
Commit SHA-1 hash: eb1d5ee318
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/2.0.3/
Microsoft .NET Core Shared Framework Host
Version : 2.0.3
Build : a9190d4a75f4a982ae4b4fa8d1a24526566c69df
服务器:
dotnet --info
.NET Command Line Tools (2.0.3)
Product Information:
Version: 2.0.3
Commit SHA-1 hash: c85173f757
Runtime Environment:
OS Name: centos
OS Version: 7
OS Platform: Linux
RID: centos.7-x64
Base Path: /opt/rh/rh-dotnet20/root/usr/lib64/dotnet/sdk/2.0.3/
Microsoft .NET Core Shared Framework Host
Version : 2.0.3
Build : N/A
但是在服务器上它不起作用:
dotnet add package JWT --version 3.1.1
Writing /tmp/tmphdc0Ux.tmp
error: Unable to load the service index for source
https://api.nuget.org/v3/index.json.
error: The type initializer for 'System.Net.Http.CurlHandler' threw an exception.
error: The type initializer for 'Http' threw an exception.
error: The type initializer for 'HttpInitializer' threw an exception.
error: Unable to load DLL 'System.Net.Http.Native': The specified module or one of its dependencies could not be found.
error: (Exception from HRESULT: 0x8007007E)
dotnet安装命令:
yum install centos-release-dotnet
yum install rh-dotnet20
我尝试了dotnet clean,并尝试将软件包版本更改为更新或更旧,没有任何作用。我的.csproj中的其他软件包已成功恢复,任何建议都将非常受欢迎。
答案 0 :(得分:2)
如果不满足.NET Core的某些本机先决条件,则会发生此错误。在这种情况下,libcurl
要么不存在,要么安装了不兼容的版本
查阅Prerequisites for .NET Core on Linux文档并确保使用最新版本(当前使用2.0.3的.NET Core Sdk 2.1.4)