title: Shared Hosting + Entity Framework + MySQL = Data Provider Errors?
body: <p>long-time listener, first-time caller!</p>
  
  <p>I’m trying to connect to MySQL using the ADO.NET Entity Framework. (Visual Studio 2010, .NET 4.0) I created a web project and another class library project to serve as my DAL. On my local machine, I have no problems, and I have also tried running with Medium trust. I’m able to fully control the db as expected.</p>
  
  <p>When I deploy to my host (shared, medium trust) however, I keep getting errors. I have tweaked my web.config multiple ways: I’ve explicitly called my assembly in the connection string, I’ve used the wildcard mapping, I added references to the MySQL dll’s, etc. </p>
  
  <hr>
  
  <pre><code>&lt;connectionStrings&gt;
      &lt;add name="NamespaceContext" connectionString="metadata=res:// Namespace.Data.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null/DataModel.csdl|res:// Namespace.Data.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null/DataModel.ssdl|res:// Namespace.Data.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null/DataModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&amp;quot;server=myserver;User Id=user;database=thedatabase;password=password;Persist Security Info=True&amp;quot;" providerName="System.Data.EntityClient"/&gt;
      &lt;add name=" NamespaceContext " connectionString="metadata=res://*/;provider=MySql.Data.MySqlClient;provider connection string=&amp;quot; server=myserver;User Id=user;database=thedatabase;password=password;Persist Security Info=True&amp;quot;" providerName="System.Data.EntityClient"/&gt;
          &lt;add name=" NamespaceContext " connectionString="metadata=res://*/DataModel.csdl|res://*/DataModel.ssdl|res://*/DataModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&amp;quot; server=myserver;User Id=user;database=thedatabase;password=password;Persist Security Info=True&amp;quot;" providerName="System.Data.EntityClient" /&gt;
   &lt;/connectionStrings&gt;
  </code></pre>
  
  <hr>
  
  <p>The error I keep getting is:</p>
  
  <pre><code>System.ArgumentException: The specified store provider cannot be found in the configuration, or is not valid. ---&gt; 
  System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed. 
  at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) 
  at System.Data.EntityClient.EntityConnection.GetFactory(String providerString) 
  --- End of inner exception stack trace --- 
  at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
  at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
  at System.Data.EntityClient.EntityConnection..ctor(String connectionString)
  at MyNamespace.Web.Html.TestPage.EntityFrameworkTestButton_Click(Object sender, EventArgs e)
  </code></pre>
  
  <p>I talked to their support guys (who aren’t devs) but they said the MySQL connector is installed and in the GAC. I tried to use the DbProviderFactories section in my web.config, like the following:</p>
  
  <pre><code>&lt;system.data&gt;
      &lt;DbProviderFactories&gt;
        &lt;clear/&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, Version=6.3.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/&gt;
      &lt;/DbProviderFactories&gt;
    &lt;/system.data&gt;
  </code></pre>
  
  <p>I was hoping I could control this and reference the provider in my project. I then receive the following error:</p>
  
  <pre><code>System.Data.MetadataException: Schema specified is not valid. 
  Errors: error 0194: All artifacts loaded into an ItemCollection must have the same version. Multiple versions were encountered. 
  MySql.Data.Entity.Properties.SchemaDefinition-6.0.ssdl(4,9) : error 0169: All SSDL artifacts must target the same provider. The ProviderManifestToken '5' is different from '5.0' that was encountered earlier. 
  error 0194: All artifacts loaded into an ItemCollection must have the same version.
  </code></pre>
  
  <p>(lots of the same error message was snipped for brevity)</p>
  
  <hr>
  
  <p>I am at a complete loss. I tried strongly signing my DAL project, not using a DAL and just creating the .edmx in the web project, all to no avail. I could have sworn I got it working at some point, but perhaps I was delirious. </p>
  
  <p>Sorry for the wall o' text. Can anyone help or shed some light? </p>
  
  <p>Thanks!</p>