Shared Hosting + Entity Framework + MySQL = Data Provider Errors?

long-term listener, first time caller!

I am 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 that will serve as my DAL. I have no problems on my local machine, and I also tried to work with average trust. Im able to fully control db as expected.

However, when I deploy to my host (general, medium trust), I keep getting errors. I changed my web.config in several ways: Ive explicitly named my assembly in the connection string, Ive used wildcard matching, added links to MySQL dlls, etc.


<connectionStrings>
    <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=&quot;server=myserver;User Id=user;database=thedatabase;password=password;Persist Security Info=True&quot;" providerName="System.Data.EntityClient"/>
    <add name=" NamespaceContext " connectionString="metadata=res://*/;provider=MySql.Data.MySqlClient;provider connection string=&quot; server=myserver;User Id=user;database=thedatabase;password=password;Persist Security Info=True&quot;" providerName="System.Data.EntityClient"/>
        <add name=" NamespaceContext " connectionString="metadata=res://*/DataModel.csdl|res://*/DataModel.ssdl|res://*/DataModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot; server=myserver;User Id=user;database=thedatabase;password=password;Persist Security Info=True&quot;" providerName="System.Data.EntityClient" />
 </connectionStrings>

The error I get is:

System.ArgumentException: The specified store provider cannot be found in the configuration, or is not valid. ---> 
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)

( arent), , MySQL GAC. DbProviderFactories web.config, :

<system.data>
    <DbProviderFactories>
      <clear/>
      <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.3.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
    </DbProviderFactories>
  </system.data>

, . :

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.

( )


. DAL, DAL .edmx -, . , - , , , .

. - ?

!

+3
2

, dll mysql bin? dll mysql, , .

0

, MySQL MySQL Entity Framework SQL Server ( , ). DLL MySQL.Data.Entity, , . , ... !

, bin obj . . , - , , . - , - .

0

Source: https://habr.com/ru/post/1777587/


All Articles