4

I have just started using Azure and I am having a problem accessing the MySQL DB I set up. It appears as if Azure is referencing the MySQL.Data.dll version 6.5.4 instead of the version I require, MySQL.Data.dll v6.8.3. I receive the following error:

MySql.Data.MySqlClient.MySqlConnection cannot be cast to MySql.Data.MySqlClient.MySqlConnection. Type A originates from 'MySql.Data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' in the context 'Default' at location 'D:\Windows\Microsoft.Net\assembly\GAC_MSIL\MySql.Data\v4.0_6.5.4.0__c5687fc88969c44d\MySql.Data.dll'. Type B originates from 'MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' in the context 'Default' at location 'C:\DWASFiles\Sites\test\Temporary ASP.NET Files\root\fc8f3c27\4f9201b0\assembly\dl3\ca8ec5e2\74482a5e_285fcf01\MySql.Data.dll'.

I tried using my application with v6.5.4 but I require v6.8.3 for it to work. Numerous searches have not revealed a solution. Does anyone have any ideas? The checked using Web Matrix that the version in the bin directory is 6.8.3. How can I reference this correct dll?

1 Answer 1

1

I had the same problem. The problem is that on the server there is installed a lower version of the MySql library.

You can bypass this modifying your web.config file:

<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.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
  </DbProviderFactories>
</system.data>
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your response. I just exported my MySQL DB to SQL Server to avoid this issue. I will keep your answer in mind if I need to do this again, thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.