'System.Data.Entity.Core.ProviderIncompatibleException' in EntityFramework



I had a project working with EF 6.0.2 but now I get an error with EF 6.1:

An exception of type 'System.Data.Entity.Core.ProviderIncompatibleException' occurred in EntityFramework.dll but was not handled in user code

Additional information: An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure.

The provider did not return a ProviderManifestToken string.

{"Unable to determine the provider name for provider factory of type 'System.Data.SqlClient.SqlClientFactory'. Make sure that the ADO.NET provider is installed or registered in the application config."}

Any idea what might be wrong? I am not sure where to look.

My DBContext is as follows:

public class Context : DbContext {

  public Context()
    : base() {

    Configuration.With(x => {
      x.LazyLoadingEnabled = false;

  }  // Context

  public DbSet<User> Users { get; set; }

  protected override void OnModelCreating(DbModelBuilder builder) {
    builder.Configurations.With(x => { x.Add(new UserMapper()) });


And on my Web.Config I have the following:

<add name="Context" providerName="System.Data.SqlClient" connectionString="Server=.\SQLEXPRESS;Database=MYDB;Trusted_Connection=true;" />

I am injecting the Context in a Repository using StructureMap:

For<DbContext>().HybridHttpOrThreadLocalScoped().Use(() => new Context());

Thank You, Miguel

4/23/2014 12:37:17 PM

Accepted Answer

Are you using Glimpse?

I think this issue will be fixed in EF 6.1.1 : https://entityframework.codeplex.com/workitem/2138

4/23/2014 1:18:57 PM

Popular Answer

I encountered the very same problem, but bizarrely in my case, I had a third inner exception complaining that it couldn't connect to my SQL instance.

Restarting the SQL services resolved the issue.

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow