Your app's app. config or Web. config file
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Configmachine.config files for the system
1. Repeat the following configuration:
<dbproviderfactories> <Addname= "MySQL Data Provider2"invariant= "MySql.Data.MySqlClient"Description= ". Net Framework Data Provider for MySQL"type= "MySql.Data.MySqlClient.MySqlClientFactory, Mysql.data, version=6.5.4.0, Culture=neutral, publickeytoken= C5687fc88969c44d " /> </dbproviderfactories>
Will throw an exception as follows:
Exception is:configurationerrorsexception-Error creating configuration section handler for System.Data: Column "InvariantName" is constrained to be unique. Value "MySql.Data.MySqlClient" already exists
2. If both are not configured, the following exception is thrown:
Exception is:argumentexception-can ' t load dbproviderfactory for given value of ProviderType
In practice, you will encounter the following questions:
Some databases are not configured in the system's Configmachine.config file if problems are installed
<name= "MySQL Data Provider2" invariant= "MySql.Data.MySqlClient" description= ". Net Framework Data Provider for MySQL" type= " MySql.Data.MySqlClient.MySqlClientFactory, Mysql.data, version=6.5.4.0, Culture=neutral, publickeytoken= c5687fc88969c44d "/>
Due to the above uncertainties, we can configure this node in our own application's App/web.config file to cause exceptions due to duplicate configuration.
Workaround:
Add this node to your application's App/web.config file:
<remove invariant= "MySql.Data.MySqlClient"/> Node
That
<System.Data> <dbproviderfactories> <Remove invariant= "MySql.Data.MySqlClient"/> <Addname= "MySQL Data Provider2" invariant= "MySql.Data.MySqlClient" Description= ". Net Framework Data Provider for MySQL"type= "MySql.Data.My sqlclient.mysqlclientfactory, Mysql.data, version=6.5.4.0, Culture=neutral, publickeytoken= C5687fc88969c44d " /> </dbproviderfactories> </System.Data>