Godaddy.com hosting, .NET 2.0 and MySQL Connector .NET SecurityException
.NET July 22nd, 2007When you setup your MySQL database, Godaddy supplies you with MySQL Connector .NET 1.0. I got the following error: “System.Security.SecurityException: That assembly does not allow partially trusted callers. at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) at _Default.GetDataTable1(String sqlString, Boolean closeConnection) at _Default.Page_Load(Object sender, EventArgs e) in d:\hosting\iliadobrev\winecellarsbulgariaorg\Default.aspx.cs:line 23 The action that failed was: LinkDemand The Zone of the assembly that failed was: MyComputer”
Problem: your ASP.NET 2.0 application is running under “medium trust” - a context not allowing calls to unsigned assemblies
Solutions for Godaddy.NET Hosting with MySQL Databases:
- Downloaded the Connector/NET 1.0 provider from the MySql site: http://dev.mysql.com/downloads/connector/net/1.0.html
- Source code were installed to the following location: C:\Program Files\MySQL\MySQL Connector Net 1.0.9
- Added the following to the AssemblyInfo.cs file:
- Using System.Security;
- [assembly: AllowPartiallyTrustedCallers()] - Added this at the end of the ‘assembly’ section
- Built the new assembly and use it.
Leave a Reply
You must be logged in to post a comment.



Recent Comments