MySQL and ADO.NET Additional information: That assembly does not allow partially trusted callers.


This is a common problem - and is because of the fact that Microsoft recommend webhosts to run shared client ASP.NET 2.0 web applications in medium trust. That's fine. More security is never wrong.

However it gives us some trouble. The thing is that they only allow network calls to Microsoft SQL Server - not MySQL or anything else when running in Medium trust.

We want the good parts from medium trust -  yet we want to be able use MySQL!

However the first problem is the ADO.NET driver. We can't even call it from our medium trust web application - getting the error

Additional information: That assembly does not allow partially trusted callers. 

So what to do? All that's really needed is to recompile the MySQL.Data.Dll with a special attribute (add it to Properties/AssemblyInfo.cs)

using System.Security; [assembly: AllowPartiallyTrustedCallers()]