3

I am using .NET Framework 4.0 and MySQL. My service providers allows me to run my website in medium 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 have gone through these links to run MySQL in medium trust mode.

When I use the code from those links, however, my code works fine with SELECT queries, but when I use an 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

2 回答 2

0

我怀疑这是 Net 4.0 的新实现,它使用的反射对于中等信任环境来说是禁忌的。使用以前的版本,我正在使用 6.5 版和 godaddy,它工作得很好。

于 2012-07-31T06:51:30.230 回答
0

我希望以下选项可以帮助您:

  • 确保您的用户已写入您的 mysqldb
  • 右键单击您的 Web 项目并单击“添加可部署的依赖项”(单击此之前,请确保在 MySQL 程序集的选项窗口中的 VS 上将程序集道具“复制到本地”设置为“真”。
  • 确保您的主机设置上的应用程序池设置为使用 .net framework 4.0 运行。
于 2012-07-31T02:48:31.943 回答