ASP.NET with MySQL: Configuration Error (MySql.Web.v20)

Recently got stucked on an issue while using MySQL db with a ASP.NET project and ran into configuration error “Parser Error Message: Could not load file or assembly ‘MySql.Web.v20, Version=6.9.4.0′” despite the fact that MySql.Data, MySql.Data.Entity and MySql.Web in my referrences, all added with nuget install-Package commands. That got me really frustrating…

Configuration Error

Description: An error occurred during the processing of a configuration file required to service    this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: Could not load file or assembly 'MySql.Web.v20, Version=6.9.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.

This issue occurs when you install MySQL .NET Connector 6.9.4 (probably other versions too) and did not uncheck “Web Providers” during the installation; it writes in your machine.config which brings you to this error.

To solve the problem properly, follow below steps :

  1. Start the installer and click “Change” then remove the “Web Providers” section entirely.MySqlConfigThis will remove the declarations from your machine.config. You can find the path to machine.config below:
    32-bit
    %windir%Microsoft.NETFramework[version]configmachine.config
    
    64-bit
    %windir%Microsoft.NETFramework64[version]configmachine.config 
    
    where [version] should equal v1.0.3705, v1.1.4322, v2.0.50727 or v4.0.30319.
    
    v3.0 and v3.5 just contain additional assemblies so there should be no configmachine.config
    
  2. When your machine config is clear add the MySql.Web assembly to your project and add the MySQLMembershipProvider declaration in your project web.config using the standard procedure.

You can find the connector for MySQL from here.

Enjoy!!

(Visited 120 times, 1 visits today)