带有MySql的.NET Core 2。数据导致权限错误
我正在使用Dapper、.NETCore2和MySql.Data在Linux上创建一个小型RESTAPI。不幸的是,我的连接中不断出现以下错误:带有MySql的.NET Core 2。数据导致权限错误,mysql,asp.net-core,Mysql,Asp.net Core,我正在使用Dapper、.NETCore2和MySql.Data在Linux上创建一个小型RESTAPI。不幸的是,我的连接中不断出现以下错误: 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: '
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()
发生异常:CLR/System.IO.FileNotFoundException
MySql.Data.dll中发生类型为“System.IO.FileNotFoundException”的异常,但未在用户代码中处理:“无法加载文件或程序集”System.Security.Permissions,版本=4.0.0.0,区域性=中性,PublicKeyToken=CC7B13FFCD2DD51”。系统找不到指定的文件。'
在MySql.Data.MySqlClient.MySqlConnection.AssertPermissions()上
在MySql.Data.MySqlClient.MySqlConnection.Open()上
在Dapper.SqlMapper.d_u124`1.MoveNext()中
有人知道发生了什么事吗 我不知道发生了什么,但我也遇到了同样的问题 我注意到,如果您查看解决方案下的
dependancies.NuGET
节点,查看“MySqlData(6.9.9)”
并展开它,您将看到一条关于使用.net Framework 4.6.1还原某些内容的警告消息。(就我而言)
在我看来,作者提供的
NuGet
包中的某些内容不正确。尝试从NuGet添加System.Security.Permissions,Version=4.0.0.0
。我通过升级到8.0.8-dmr解决了这个问题 我收到了相同的错误,但找不到版本4.0.0.0,所以我安装了版本4.5.0.0,但仍然有效。我收到了与8.0.24相同的错误。