Sunday, July 23, 2006

If you are hosting ASP.Net 2.0 on GoDaddy and using the MySql .Net Connector for MySql please read

First download the Connector/NET 1.0 installer from the MySql site (do not get the source code only download as it is buggy. The installer download contains the source also.)

After installing the MySql .Net Connector, in VS 2005 Add an Existing Project to your solution by browsing to C:\Program Files\MySQL\MySQL Connector Net 1.0\src\ MySql.Data.csproj file.

After adding the project, open the MySql project and add the following to the AssemblyInfo.cs file in the perspective locations:
using System.Security; //added for GoDaddy Host
[assembly: AllowPartiallyTrustedCallers()] //added for GoDaddy Host
Build the project and then either reference the MySql project or browse to the new MySql.Data.dll assembly directly.

Special thanks to a post from Alek at GoDaddy’s Support team on Microsoft’s Asp.Net Forum site. Apparently, as of June 22, 2006, "has updated the custom medium trust configuration to allow the MySql.Data.Dll to work in a medium trust environment for the .Net 2.0 development environment." He then goes on to instruct you to set the AllowPartiallyTrustedCallers attribute in the AssemblyInfo file. Also thanks to others for pointing out the referencing the System.Security namespace in the AssemblyInfo file.

UPDATE: By request I have posted the compiled MySql.Data.DLL Assembly. Get it here.

No comments: