实体框架探查器 - 带有 EF 6 的 ASP.NET MVC4 - 无法确定提供程序名称 [英] Entity Framework profiler - ASP.NET MVC4 with EF 6 -Unable to determine the provider name

查看:24
本文介绍了实体框架探查器 - 带有 EF 6 的 ASP.NET MVC4 - 无法确定提供程序名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 ASP.NET MVC4 项目中使用 EF 6 已经有一段时间了,没有任何问题.

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

当我将 Entity Framework Profiler 添加到项目时出现问题,然后突然出现以下错误:无法确定类型为‘System.Data.SqlClient.SqlClientFactory’的提供程序工厂的提供程序名称.确保ADO.NET 提供程序已安装或在应用程序配置中注册."

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."

我尝试了一些建议,包括 bin 文件夹中不存在EntityFramework.SqlServer.dll"的问题.

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

堆栈跟踪:

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:

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>

连接细节:

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

你知道是什么原因造成的吗?

Any ideas what's causing this?

注意事项:

  • 我正在使用 ninject 来处理依赖注入
  • 我最近升级到了 EF 6.0.1

推荐答案

这是由实体框架分析器中的错误引起的,已在 build 2214 中修复(参见:http://hibernatingrhinos.com/builds/uber-prof-v2/2214)

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)

这篇关于实体框架探查器 - 带有 EF 6 的 ASP.NET MVC4 - 无法确定提供程序名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆