How to start MySQL in trust mode?

I am using the .NET Framework 4.0 and MySQL. My service providers allow me to run my site in trust mode. When I host my site, the following error is generated:

Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. 

To overcome this, I went through these links to start MySQL in trust mode.

However, when I use the code from these links, my code works fine with SELECT queries, but when I use the INSERT query, the following error is generated:

 Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. 

How can I solve this problem?

+4
source share
2 answers

I hope the options below help you:

  • Make sure your user has access to your mysqldb
  • Right-click your web project and click Add Deployable Dependencies. (Before clicking on this button, make sure that you set "copy assembly link" to "local" as "true" in VS in the MySQL build options window.
  • Make sure your application pool on your host settings is installed in the .NET Framework 4.0.
0
source

I suspect this is a new implementation for Net 4.0, and it uses reflection that is not related to the trust environment. Use the previous version, I am using version 6.5 with godaddy and it works fine.

0
source

All Articles