Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Core 2 with MySql.Data results in permission error

I'm using Dapper, .NET Core 2 and MySql.Data to create a small REST API on Linux. Unfortunately, i keep getting this error on my connection:

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()

Does anyone have any idea what is going on?

like image 709
vinnylinux Avatar asked Aug 29 '17 14:08

vinnylinux


1 Answers

Try adding System.Security.Permissions, Version=4.0.0.0 from nuget.

like image 160
knowledgeseeker Avatar answered Sep 30 '22 07:09

knowledgeseeker