Groups > Databases > MySQL for ASP.NET > Re: Application Trust Level for MySql Connector.net




Application Trust Level for MySql Connector.net

Application Trust Level for MySql Connector.net
Fri, 22 Feb 2008 03:29:51 +000
Hi All

I host a site on shared hosting, and the site uses the MySQL connector.net to
access a MySQL database on another server.    The problem is the hosting company
is telling me that they can't allow full trust on the server, so when an attempt
to use the database is made, I get the following error message, so what can I
do?  Can I tweak something in the site web.config?

 
Security Exception
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 failed.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can be
identified using the exception stack trace below.
Stack Trace:



[SecurityException: Request failed.]
   System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm,
PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh,
SecurityAction action, Object demand, IPermission permThatFailed) +150
   System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object
assemblyOrString, PermissionSet granted, PermissionSet refused,
RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission
permThatFailed) +100
   System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants,
PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object
assemblyOrString, SecurityAction action, Boolean throwException) +281
   System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet,
PermissionSet& alteredDemandset, RuntimeMethodHandle rmh) +67
   System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset,
RuntimeMethodHandle rmh) +145
   System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags,
PermissionSet grantSet) +43
   System.Threading.CompressedStack.DemandFlagsOrGrantSet(Int32 flags,
PermissionSet grantSet) +41
   System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32
permission, PermissionSet targetGrant, CompressedStack securityContext) +139
   System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32
permission, PermissionSet targetGrant) +51



Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET
Version:2.0.50727.1433 

Thanks

Accelerator
Post Reply
Re: Application Trust Level for MySql Connector.net
Fri, 22 Feb 2008 09:22:55 +000
Hi,

Which version of the connector are you using? The latest version of the
connector should have solved the issues with the trust level. The 5.1 connector
can be downloaded here http://dev.mysql.com/downloads/connector/net/5.1.html
Post Reply
Re: Application Trust Level for MySql Connector.net
Fri, 22 Feb 2008 22:05:21 +000
It looks as though it could have been version 1.0.7, with MySql.Data.dll having
a file size of 140KB last modified 30/07/2006.   

I have just tried the 5.1 version of MySql.Data.dll in my bin folder and I'm
getting exactly the same error.  

Can anyone provide further explanation of the error and possible actions to
take?  My host is telling me they don't want to run full trust on the server so
I guess I have to make it work under medium trust somehow.  

Thanks all

Accelerator
Post Reply
about | contact