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

点点圈 提交于 2019-12-01 08:38:51

问题


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

回答1:


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.




回答2:


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)



来源:https://stackoverflow.com/questions/19903037/entity-framework-profiler-asp-net-mvc4-with-ef-6-unable-to-determine-the-prov

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!