I am getting this strange inexplicable error when I uploaded my application to a server for testing. From what I studied, it seems to be caused by conflicting MySql.Data, th
As the expection says, you are using two different versions of MySql. Version 6.2.3.0
and version 6.3.7.0
. From this point on I can only guess: Maybe you are using a dll built with a different version of MySql (and it allows installation side by side).
I got the same problem but years later!
My server has installed in gac the MySql Connector 6.4.6 version, but I'm working with the 6.8.3 version, I was getting the "cannot be cast error". I fixed it by adding the following section to the .config file
<system.data>
<DbProviderFactories>
<!-- Removes the dll installed in gac-->
<remove invariant="MySql.Data.MySqlClient" />
<!-- Add the dll copied in the bin folder-->
<add name="MySQL" description="ADO.Net driver for MySQL" invariant="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"/>
</DbProviderFactories>
</system.data>
I had the same issue, conflict between version 18 and 19. Doing this in web.config fixed it. Set the new version to the one you have in your machine.
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.18.0" newVersion="8.0.19.0" />
</dependentAssembly>