Entity Framework profiler - ASP.NET MVC4 with EF 6 -Unable to determine the provider name

asp.net-mvc-4 c# entity-framework-6 profiler

Question

I've been using EF 6 in my ASP.NET MVC4 project for a while now without any issues.

The problem comes in when I add Entity Framework Profiler to the project, then suddenly I get the following error: "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."

I've tried a couple of suggestions including an issue where the "EntityFramework.SqlServer.dll" was not present in the bin folder.

Stack trace:

System.Data.Entity.Config.DefaultInvariantNameResolver.GetService(Type type, Object key) +440
System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +83
System.Data.Entity.Config.CachingDependencyResolver.GetService(Type type, Object key) +179
System.Linq.WhereSelectArrayIterator`2.MoveNext() +82
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate) +215
System.Linq.WhereSelectArrayIterator`2.MoveNext() +82
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate) +215
System.Data.Entity.Config.CompositeResolver`2.GetService(Type type, Object key) +71
System.Data.Entity.Config.IDbDependencyResolverExtensions.GetService(IDbDependencyResolver resolver, Object key) +84
System.Data.Entity.Internal.InternalConnection.get_ProviderName() +112
System.Data.Entity.Internal.DefaultModelCacheKeyFactory.Create(DbContext context) +120
System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +319
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +26
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +72
System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21
System.Data.Entity.Internal.Linq.InternalSet`1.Find(Object[] keyValues) +40

Web.config:

  <entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
  <parameters>
    <parameter value="v11.0" />
  </parameters>
</defaultConnectionFactory>
<providers>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>

Connection detail:

<add name="MyProject" connectionString="Server=.\SQLEXPRESS;database=MyDatabase;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />

Any ideas what's causing this?

Notes:

  • I'm making use of ninject to handle dependency injection
  • I've recently upgraded to EF 6.0.1

Accepted Answer

This was caused by a bug in Entity framework profiler and has been fixed in build 2214 (See :http://hibernatingrhinos.com/builds/uber-prof-v2/2214)


Popular Answer

Just as a tip. This error can also be thrown if you install Glimpse ef6 to your project.

I had this error as soon I installed Glimpse EF6. Uninstalling Glimpse EF6 solved the issue.




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why