title: Failed to find or load the registered .Net Framework Data Provider with MySql + MVC4
body: <p>We are getting the following error when we tried running our MVC4 Project with Azure Mysql DB. </p>
  
  <p>In Web.Config file we have the following,</p>
  
  <pre><code>&lt;DbProviderFactories&gt;
        &lt;remove invariant="MySql.Data.MySqlClient" /&gt;
        &lt;add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" /&gt;
  &lt;/DbProviderFactories&gt;
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
    <p>Failed to find or load the registered .Net Framework Data Provider.</p>
    
    <p>Description: An unhandled exception occurred during the execution of
    the current web request. Please review the stack trace for more
    information about the error and where it originated in the code. </p>
    
    <p>Exception Details: System.Configuration.ConfigurationErrorsException:
    Failed to find or load the registered .Net Framework Data Provider.</p>
  </blockquote>
  
  <p>Source Error: </p>
  
  <pre><code>Line 96:             if (objectQuery != null &amp;&amp; !string.IsNullOrEmpty(path))
  Line 97:             {
  Line 98:                 return objectQuery.Include(path);
  Line 99:             }
  Line 100:
  
  Source File: C:\Phase2\FreeLance\FreeLance\Framework\Data\FreeLance.Data.Framework\EntityFramework\Extensions.cs    Line: 98 
  
  Stack Trace: 
  
  
  [ConfigurationErrorsException: Failed to find or load the registered .Net Framework Data Provider.]
     System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow) +2238858
     System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +143
     System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +641
     System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config) +144
     System.Data.Entity.Internal.LazyInternalConnection.Initialize() +95
     System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel() +16
     System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +269
     System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +26
     System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +71
     System.Data.Entity.Internal.Linq.InternalSet`1.Include(String path) +25
     System.Data.Entity.Infrastructure.DbQuery`1.Include(String path) +111
     FreeLance.Data.Framework.EntityFramework.Extensions.Include(IQueryable`1 source, String path) in C:\Phase2\FreeLance\FreeLance\Framework\Data\FreeLance.Data.Framework\EntityFramework\Extensions.cs:98
     FreeLance.Data.Framework.EntityFramework.Extensions.Include(IQueryable`1 source, Expression`1 expression) in C:\Phase2\FreeLance\FreeLance\Framework\Data\FreeLance.Data.Framework\EntityFramework\Extensions.cs:64
     FreeLance.Data.Framework.EntityFramework.Extensions.Include(IQueryable`1 source, Expression`1[] expressions) in C:\Phase2\FreeLance\FreeLance\Framework\Data\FreeLance.Data.Framework\EntityFramework\Extensions.cs:79
     FreeLance.Data.Framework.EntityFramework.Repository`1.GetAll(Expression`1[] include) in C:\Phase2\FreeLance\FreeLance\Framework\Data\FreeLance.Data.Framework\EntityFramework\Repository.cs:89
     FreeLance.Business.PageBC.GetPages() in C:\Phase2\FreeLance\FreeLance\Business\FreeLance.Business\Admin\PageBC.cs:49
     FreeLance.Services.PageService.GetPages() in C:\Phase2\FreeLance\FreeLance\Services\FreeLance.Services\PageService.cs:54
     FreeLance.Web.Helpers.DataHelper.GetAppPages() in C:\Phase2\FreeLance\FreeLance\User Interface\FreeLance.Web\Helpers\DataHelper.cs:250
     FreeLance.Web.ResourceConfig.GetAppPages() in C:\Phase2\FreeLance\FreeLance\User Interface\FreeLance.Web\App_Start\ResourceConfig.cs:64
     FreeLance.Web.AppConfig.Run() in C:\Phase2\FreeLance\FreeLance\User Interface\FreeLance.Web\App_Start\AppConfig.cs:55
     FreeLance.Web.MvcApplication.Application_Start() in C:\Phase2\FreeLance\FreeLance\User Interface\FreeLance.Web\Global.asax.cs:40
  
  [HttpException (0x80004005): Failed to find or load the registered .Net Framework Data Provider.]
     System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +4054645
     System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
     System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352
     System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
     System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375
  
  [HttpException (0x80004005): Failed to find or load the registered .Net Framework Data Provider.]
     System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11646640
     System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
     System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4869909
  </code></pre>