ASP.NET returns Unable to find the requested .Net Framework Data Provider when connecting to mysql database

Programming, error messages and sample code > ASP.NET

If you are using asp.net + mysql database,you might receive the following error on our hosting server:

Unable to find the requested .Net Framework Data Provider.  It may not be installed.

To resolve this issue, please do the following:

1. In your local machine, please find and upload this file to your BIN folder:  Mysql.Data.dll

You should be able to find it in places like C:\Program Files\MySQL\MySQL Connector Net 6.6.4\Assemblies  (Given that you already installed "MySQL .NET connector".

2. Edit your webconfig.  Assuming you're using version 6.6.4  (please make sure you use the correct version.)

<system.web>
      <compilation debug="true" urlLinePragmas="true">
                        <assemblies>
                                <add assembly="MySql.Data,Version=6.6.4, Culture=neutral,PublicKeyToken=C5687FC88969C44D"/>
                        </assemblies>
                </compilation>
</system.web>
<system.data>
    <DbProviderFactories>
      <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.6.4, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
    </DbProviderFactories>
</system.data>