I am trying to publish a website with our hosting provider. I am getting error due to the fact that they only allow a medium trust and the MySQL Connector/Net that I am using requires reflection to work. Unfortunately, reflection is not allowed in a medium trust.

After some research I found out that the newest version of the MySQL Connector/Net may solve this problem. Connector/Net 6.6 includes enhancements to partial trust support to allow hosting services to deploy applications without installing the Connector/Net library in the GAC. I am thinking that will solve my problem.

So, I unistalled MySQL Connector/Net 6.4.4 and I installed MySQL Connector/Net 6.6.4.

When I run the application in Visual Studio 2010 I get the error:

ProviderIncompatibleException was unhandled by user code  

The message is

An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.

InnerException is

The provider did not return a ProviderManifestToken string.

Everything works fine when I have Connector/Net 6.4.4 installed. I can access the database and perform Read/Write/Delete action against it.

I have a reference to the following in the project:

  • MySql.Data
  • MySql.Data.Entity
  • MySql.Web

My connection string in Web.config

  <add name="AESSmartEntities" 
          providerName="MySql.Data.MySqlClient" />

What might I be doing wrong? Do I need any additional setting(s) to work with version 6.6.4 that wasn't required in the older version 6.4.4?

  • This is way, way, way over my head.. have you tried our siste site for DBA's - dba.stackexchange.com? – pauska Nov 20 '12 at 16:50

I also had this question posted on the MySQL forum. Here is the response I received:

You're correct about that Connector/Net doesn't have to be in the GAC in order to work with Medium Trust, but this has some limitations. For the case of Entity Framework our driver needs Reflection, as you mention it, in order to be registered as a provider. Thus it can't be used without this permission. You need to add this reflection permission only for Member access to your policy or install the driver in the GAC.

We are looking for other ways to register the provider for Entity Framework. So far Connector can work with ADO.Net in Medium trust but not yet EF. We'll notify you as soon as we have this supported without the GAC for Medium Trust.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.