带有MySql.Data的.NET Core 2导致权限错误

vin*_*nux 4 mysql asp.net-core

我正在使用Dapper,.NET Core 2和MySql.Data在Linux上创建一个小型REST API.不幸的是,我不断在我的连接上收到此错误:

Exception has occurred: CLR/System.IO.FileNotFoundException
An exception of type 'System.IO.FileNotFoundException' occurred in MySql.Data.dll but was not handled in user code: 'Could not load file or assembly 'System.Security.Permissions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.'
at MySql.Data.MySqlClient.MySqlConnection.AssertPermissions()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at Dapper.SqlMapper.<QueryImpl>d__124`1.MoveNext()
Run Code Online (Sandbox Code Playgroud)

有谁知道发生了什么事?

kno*_*ker 8

尝试System.Security.Permissions, Version=4.0.0.0从nuget 添加.


vin*_*nux 2

我通过升级到 8.0.8-dmr 解决了。