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

时间:2016-11-21 12:47:10

标签: asp.net asp.net-mvc-4 asp.net-web-api

我正在我的linux机器上运行一个ASP核心项目。

我在样板本身上做的很少,只保留了一些模型。

我今天早上试着运行这个项目,然后突然间它破了。什么都行不通。我已经在互联网上窥探了几个小时,但都可以利用,因为大多数遇到此问题的用户都在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()

任何可能的想法或解决方案

1 个答案:

答案 0 :(得分:0)

这个问题持续了大约2天......什么都没有。

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

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

谢谢S.O。