'Crypto'的类型初始值设定项引发异常

问题描述:

我在我的linux机器上运行一个ASP Core项目。'Crypto'的类型初始值设定项引发异常

我对样板本身做了很少的工作,只保留了一些模型。

今天早上我试着运行这个项目,突然间断了。什么都没有我已经窥探了互联网几个小时,但都可以利用,因为大多数遇到此问题的用户都在运行在Mac系统中。请参阅下面的堆栈跟踪。

Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0] 
     An unhandled exception has occurred: The type initializer for 'Crypto' threw an exception. 
System.TypeInitializationException: The type initializer for 'Crypto' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native.OpenSsl': The specified module could not be found. 
(Exception from HRESULT: 0x8007007E) 
    at Interop.Crypto.GetMaxMdSize() 
    at Interop.Crypto..cctor() 
    --- End of inner exception stack trace --- 
    at Interop.Crypto.EvpMd5() 
    at Internal.Cryptography.HashProviderDispenser.CreateHashProvider(String hashAlgorithmId) 
    at System.Security.Cryptography.MD5.Implementation..ctor() 
    at Npgsql.FrontendMessages.PasswordMessage.CreateMD5(String password, String username, Byte[] serverSalt) 
    at Npgsql.NpgsqlConnector.ProcessAuthenticationMessage(String username, AuthenticationRequestMessage msg) 
    at Npgsql.NpgsqlConnector.HandleAuthentication(String username, NpgsqlTimeout timeout) 
    at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout) 
    at Npgsql.ConnectorPool.Allocate(NpgsqlConnection conn, NpgsqlTimeout timeout) 
    at Npgsql.NpgsqlConnection.OpenInternal() 
    at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open() 
    at Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlDatabaseCreator.Exists() 
    at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.EnsureCreated() 

任何可能的思路或解决方案

+0

System.Security.Cryptography.Native.OpenSsl存在吗? –

+0

@DanielHilgarth在哪里?我应该在哪里检查? –

+0

您可以打开LD_DEBUG以获取它探测的位置。另外,它可能是一个最近才被修复的bug:https://github.com/dotnet/corefx/issues/12517 –

有问题了约2天...什么都没有。

无论如何,我所要做的就是转移到NetCoreApp:1.1.0版本。

我安装的版本,我很好:)

谢谢S.O.