.NET MySQL Connector Conflicting DbProviderFactories

后端 未结 2 864
日久生厌
日久生厌 2020-12-14 17:46

I\'m using the .NET MySQL Connector with Entity Framework 4, and everything worked great but I wanted to package the MySQL client DLL files with my application when deployed

相关标签:
2条回答
  • 2020-12-14 18:17

    You can also consider to copy all mysql DLLs from C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.0 into your project's bin folder. By that way EF6 can reach all required MySQL connector(MySql.Data) sub-classes.

    0 讨论(0)
  • 2020-12-14 18:19

    try to add < remove invariant="MySql.Data.MySqlClient" / > in your webconfig. On your computer, you have installed the Connector for MySql and your machine.config have been modified by adding an item in the DbProviderFactories. So if you put another MySql Data Provider in your web.config, its like if you are trying to register the same thing twice.

    <system.data>
        <DbProviderFactories>
          <remove invariant="MySql.Data.MySqlClient" />
          <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.3.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
        </DbProviderFactories>
    </system.data>
    
    0 讨论(0)
提交回复
热议问题