Microsoft.AspNetCore.Cryptography.Internal.dll:'无法加载DLL' kernel32.dll'

时间:2018-04-23 17:08:59

标签: c# linux .net-core

我的电脑是(lsb_release -a):

LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.4.1708 (Core) 
Release:    7.4.1708
Codename:   Core

我的dotnet核心版本(dotnet --version)是:

2.1.105

我的openssl版本是:

openssl 
OpenSSL> version
OpenSSL 1.1.0h  27 Mar 2018

当我尝试加载服务器时出现以下错误:

Exception has occurred: CLR/System.DllNotFoundException
Exception thrown: 'System.DllNotFoundException' in Microsoft.AspNetCore.Cryptography.Internal.dll: 'Unable to load DLL 'kernel32.dll': The specified module or one of its dependencies could not be found.
 (Exception from HRESULT: 0x8007007E)'
   at Microsoft.AspNetCore.Cryptography.SafeHandles.SafeLibraryHandle.UnsafeNativeMethods.LoadLibraryEx(String lpFileName, IntPtr hFile, UInt32 dwFlags)
   at Microsoft.AspNetCore.Cryptography.SafeHandles.SafeLibraryHandle.Open(String filename)

我的.csproj是:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <NeutralLanguage>pt-BR</NeutralLanguage>
    <Authors>Cogtive Team</Authors>
    <Company>Cogtive Opex Software</Company>
    <Product>Cogtive Core Api V2</Product>
    <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
    <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <DocumentationFile>bin\Debug\netcoreapp2.0\Cogtive.Core.Api.V2.xml</DocumentationFile>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.2.1" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.0.2" />
    <PackageReference Include="Microsoft.AspNetCore.ApplicationInsights.HostingStartup" Version="2.0.2" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.3" />
    <PackageReference Include="Microsoft.AspNetCore.ResponseCaching" Version="2.0.2" />
    <PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="2.0.2" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.2" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.1" />
    <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="2.3.0" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Cogtive.Core.Application\Cogtive.Core.Application.csproj" />
  </ItemGroup>
</Project>

rpm -q openssl返回:

openssl-1.0.2k-8.el7.x86_64

rpm -qa | grep openssl返回:

xmlsec1-openssl-1.2.20-7.el7_4.x86_64
openssl-devel-1.0.2k-8.el7.x86_64
openssl-1.0.2k-8.el7.x86_64
openssl-libs-1.0.2k-8.el7.x86_64
直到最近才工作正常,但现在我又无法再次使用了。

我的电脑可能更新了图书馆或其他东西,现在它已经不能用了。

任何想法?

1 个答案:

答案 0 :(得分:0)

OpenSSL版本看起来非常令人沮丧。以下是我在CentOS上的内容:

[omajid@localhost ~]$ rpm -q openssl
openssl-1.0.2k-8.el7.x86_64
[omajid@localhost ~]$ openssl
OpenSSL> version
OpenSSL 1.0.2k-fips  26 Jan 2017

你从哪里得到1.1?你能降级到1.0吗? .NET Core与1.1.x不兼容:https://github.com/dotnet/corefx/issues/9855