MySQL在一个中等信任共享环境连接器6.7.4 [英] MySql Connectors 6.7.4 on a medium trust shared environment

查看:184
本文介绍了MySQL在一个中等信任共享环境连接器6.7.4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我想说,我试图通过从人们有同样的问题,尝试了一堆不同的方法来解决这个问题了几个小时,但都无济于事。我是pretty的无能,在这一点上。

first of all, I would like to say that I have tried to resolve this issue for several hours through trying a bunch of different approaches from people that had the same issues, but to no avail. I am pretty clueless at this point.

我使用MySql.Data和MySql.Data.Entity的DLL(6.7.4版),我在我的ASP.NET 4.5应用程序都引用。

I am using MySql.Data and MySql.Data.Entity dlls (version 6.7.4) which I have referenced in my ASP.NET 4.5 application.

我已成功地连接(本地)到我的数据库和查询它没有问题。

I have managed to connect (locally) to my database and query it without a problem.

SqlConnection = new MySqlConnection("server=localhost;User Id=;Password=;database=;");

现在的问题是在一个中等信任共享环境。 我得到以下错误(当试图连接到数据库):

The problem is within a medium trust shared environment. I get the following error (when attempting to connect to the database):

说明:应用程序试图执行安全策略不允许的操作。要授予此应用程序所需的权限,请与系统管理员联系,或更改应用程序的信任级别的配置文件研究。 异常详细信息:System.Security.SecurityException:请求类型的权限'System.Security.Permissions.SecurityPermission,mscorlib程序,版本= 4.0.0.0,文化=中性公钥= b77a5c561934e089'失败

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

我也尝试添加集成安全性= TRUE; includesecurityasserts = TRUE; autoenlist = FALSE;在连接字符串,但没有帮助。

I have also tried to add "Integrated Security=True;includesecurityasserts=true;autoenlist=false;" to the connection string, but didn't help.

我也试图加入这个在我的web.config:

I have also tried to add this in my web.config:

<mscorlib>
<security>
  <policy>
    <PolicyLevel version="1">
      <SecurityClasses>
        <SecurityClass Name="MySqlClientPermission" Description="MySql.Data.MySqlClient.MySqlClientPermission, MySql.Data, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
      </SecurityClasses>
      <NamedPermissionSets>
        <PermissionSet class="NamedPermissionSet" version="1" Name="ASP.Net">
          <IPermission class="MySqlClientPermission" version="1" Unrestricted="true">
          </IPermission>
        </PermissionSet>
      </NamedPermissionSets>
    </PolicyLevel>
  </policy>
</security>

但是,这并不能工作。

我又试图通过下面的一些文章加了一堆PermissionSets,IPermissions,什么不是在web.config中,但似乎并没有为我工作。

I have then tried to add a bunch of PermissionSets, IPermissions and what not in the web.config by following some articles, but that didn't seem to work for me.

请注意:

  • 设置信任级别=全,在web.config中不是一个选项。
  • ,我用它来连接到数据库是不是在我的web.config,我想保持这种方式的连接字符串。
  • 使用别的比MySQL是不是一种选择。

任何及所有的帮助是AP preciated!谢谢!

Any and all help is appreciated! Thank you!

修改

我已经改变了我与ODBC连接数据库的通信方式。 正常工作使用完全信任,但只要我改变到中等信任,我得到基本相同的错误与MySQL连接。

I have changed the way I communicate with the database with an ODBC connection. Works properly using full trust, but as soon as I change to medium trust, I get basically the same error as with MySql connectors.

请求类型的权限'System.Data.Odbc.OdbcPermission,System.Data这,版本= 4.0.0.0,文化=中性公钥= b77a5c561934e089失败。

Request for the permission of type 'System.Data.Odbc.OdbcPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

任何人都可以请点我到正确的方向,比如你如何设法使它工作,因为我似乎无法使用媒体的信任,使这项工作的完整示例...

Can anyone please point me to the right direction, such as a full example on how you managed to make it work, because I can't seem to make this work using medium trust...

谢谢!

推荐答案

我结束了使用ODBC连接。

I ended up using an ODBC connection.

Driver={MySQL ODBC 5.1 Driver};Server=myServerAddress;Database=myDataBase; User=myUsername;Password=myPassword;Option=3;

http://www.connectionstrings.com/mysql - 连接器-ODBC-5-1 /远程数据库/

这篇关于MySQL在一个中等信任共享环境连接器6.7.4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆