【发布时间】:2018-06-26 16:05:24
【问题描述】:
我在 CentOS 上安装了 dotnet core,还有一个正在使用 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 中的其他软件包已成功恢复,任何建议将不胜感激。
【问题讨论】:
-
我创建了一张 CentOS7 的镜像,没有任何问题 sample output。您收到的错误似乎是由于 dotnet SDK 的安装不完整和/或损坏。你是怎么安装的?如果您是从 Microsoft 产品源安装的,那么您会从
yum list installed | grep microsoft获得什么输出? -
@Pace,感谢您的评论,我编辑了问题以说明我是如何安装 dotnet 的。
yum list installed | grep microsoft不返回任何内容
标签: .net asp.net-core nuget