Responsive Ad Area

Share This Post


How to fix Problem with configuration in Entity Framework

If updated my project to 8.0.13 and MySql.Data.EntityFramework. The target Framework is .net 4.5.2 EF is on 6.2
I have now the strange behavoiur that i have to add the part to my configuration

      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory,MySql.Data" />

Then it’s running on some machines. But on others you get following error. (translated to english since system is german)

System.Configuration.ConfigurationErrorsException: An error occurred when creating the configuration section handler for The column 'InvariantName' has the restriction that it must be unique. The value 'MySql.Data.MySqlClient' already exists. 

So if i cut out this part of the configuration it works. But on the other machine it states.

System.ArgumentException: The ADO.NET provider with the invariant name 'MySql.Data.MySqlClient' was either not registered on the computer or in the application configuration file, or could not be loaded.  

Is there any solution or check possible? Because i also have the strange behaviour for different users on the same pc (rolling out with clickonce)

The configuration part of EF

    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework"></provider>

This should work on any pc. I also don’t really know how to add more information because I really don’t know where the problem is. Tried to fix this the whole weekend.

How to fix Problem with configuration in Entity Framework
How to fix Problem with configuration in Entity Framework

Share This Post

Leave a Reply

Your email address will not be Publishedd. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Skip to toolbar