如何让 Glimpse 与 EF6 一起使用?

2024-01-15

EDIT:在底部添加堆栈跟踪。

我有一个 ASP.NET MVC 5 项目,它通过 Entity Framework 6 使用 SQL Server 数据库。

我将 Glimpse(和 Glimpse.MVC5)添加到项目中,效果很好。

但是,当我添加 Glimpse.EF6 时,我的应用程序一旦尝试访问数据库就会引发异常。例外的是:

System.NotSupportedException

无法确定“System.Data.SqlClient.SqlClientFactory”类型的提供程序工厂的提供程序名称。确保 ADO.NET 提供程序已安装或在应用程序配置中注册。

这是怎么回事?仅供参考,connectionStrings我的 web.config 的一部分如下所示:

<connectionStrings>
  <add name="DefaultConnection" connectionString="Data Source=.; Initial Catalog=foo; Integrated Security=True; MultipleActiveResultSets=True;" providerName="System.Data.SqlClient" />
</connectionStrings>

...和我的Application_Start方法如下所示:

protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();
    GlobalConfiguration.Configure(WebApiConfig.Register);
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);

    Database.SetInitializer(new WebApplication.Models.Storage.ApplicationDbInitializer());
}

...我的上下文类如下所示:

public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
    public ApplicationDbContext()
        : base("DefaultConnection")
    {
    }

    public DbSet<Foo> Foos { get; set; }
}

预先感谢您的帮助...


堆栈跟踪:

[NotSupportedException: 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.]
System.Data.Entity.Utilities.DbProviderFactoryExtensions.GetProviderInvariantName(DbProviderFactory factory) +290
System.Data.Entity.Infrastructure.DependencyResolution.DefaultInvariantNameResolver.GetService(Type type, Object key) +248
System.Data.Entity.Infrastructure.DependencyResolution.<>c__DisplayClass1.<GetService>b__0(Tuple`2 k) +75
System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +72
System.Data.Entity.Infrastructure.DependencyResolution.CachingDependencyResolver.GetService(Type type, Object key) +210
System.Data.Entity.Infrastructure.DependencyResolution.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r) +60
System.Linq.WhereSelectArrayIterator`2.MoveNext() +66
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate) +161
System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.GetService(Type type, Object key) +250
System.Data.Entity.Infrastructure.DependencyResolution.RootDependencyResolver.GetService(Type type, Object key) +106
System.Data.Entity.Infrastructure.DependencyResolution.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r) +60
System.Linq.WhereSelectArrayIterator`2.MoveNext() +66
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate) +94
System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.GetService(Type type, Object key) +250
System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver`2.GetService(Type type, Object key) +102
System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetService(IDbDependencyResolver resolver, Object key) +145
System.Data.Entity.Core.Common.<>c__DisplayClass5.<GetExecutionStrategy>b__4(ExecutionStrategyKey k) +84
System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +72
System.Data.Entity.Core.Common.DbProviderServices.GetExecutionStrategy(DbConnection connection, DbProviderFactory providerFactory) +351
System.Data.Entity.Core.Common.DbProviderServices.GetExecutionStrategy(DbConnection connection) +62
System.Data.Entity.SqlServer.SqlProviderServices.UsingConnection(DbConnection sqlConnection, Action`1 act) +319
System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(DbConnection sqlConnection, Action`1 act) +335
System.Data.Entity.SqlServer.SqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +399
System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +132

[ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.]
System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +327
Glimpse.EF.AlternateType.GlimpseDbProviderServices.GetDbProviderManifestToken(DbConnection connection) +113
System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +255
System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +67

[ProviderIncompatibleException: 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.]
System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +277
System.Data.Entity.Infrastructure.<>c__DisplayClass1.<ResolveManifestToken>b__0(Tuple`3 k) +63
System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +72
System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.ResolveManifestToken(DbConnection connection) +360
System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +89
System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +79
System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +143
System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +171
System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +594
System.Data.Entity.Internal.InternalContext.Initialize() +31
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +39
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +138
System.Data.Entity.Internal.Linq.InternalSet`1.Include(String path) +41
System.Data.Entity.Infrastructure.DbQuery`1.Include(String path) +142
System.Data.Entity.QueryableExtensions.Include(IQueryable`1 source, String path) +205
System.Data.Entity.QueryableExtensions.Include(IQueryable`1 source, Expression`1 path) +305
Microsoft.AspNet.Identity.EntityFramework.UserStore`6.GetUserAggregateAsync(Expression`1 filter) +610
Microsoft.AspNet.Identity.EntityFramework.UserStore`6.FindByNameAsync(String userName) +1070
Microsoft.AspNet.Identity.<FindByNameAsync>d__10.MoveNext() +283
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
System.Runtime.CompilerServices.ConfiguredTaskAwaiter.GetResult() +24
Microsoft.AspNet.Identity.<FindAsync>d__18.MoveNext() +673
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24
WebApplication.Controllers.<Login>d__2.MoveNext() in c:\Users\Gary\Documents\Visual Studio 2013\Projects\eByGum\WebApplication\Controllers\AccountController.cs:49
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21
System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task) +61
System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +114
System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult) +66
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +136
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +49
Castle.Proxies.AsyncControllerActionInvokerProxy.EndInvokeActionMethod_callback(IAsyncResult asyncResult) +42
Castle.Proxies.Invocations.AsyncControllerActionInvoker_EndInvokeActionMethod.InvokeMethodOnTarget() +103
Castle.DynamicProxy.AbstractInvocation.Proceed() +117
Glimpse.Core.Extensibility.CastleInvocationToAlternateMethodContextAdapter.Proceed() +48
Glimpse.Mvc.AlternateType.EndInvokeActionMethod.NewImplementation(IAlternateMethodContext context) +152
Glimpse.Core.Extensibility.AlternateTypeToCastleInterceptorAdapter.Intercept(IInvocation invocation) +183
Castle.DynamicProxy.AbstractInvocation.Proceed() +483
Castle.Proxies.AsyncControllerActionInvokerProxy.EndInvokeActionMethod(IAsyncResult asyncResult) +203
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +117
System.Web.Mvc.Async.<>c__DisplayClass48.<InvokeActionMethodFilterAsynchronouslyRecursive>b__41() +323
System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +44
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +136
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +72
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +184
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44
System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +39
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +62
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +39
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9514812
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

对于那些正在寻找解决方法的人:

看起来这是一个EF 本身的错误 https://github.com/Glimpse/Glimpse/issues/713(上面提到了173,但链接是正确的)。您可以等待 EF 6.1.1/6.2,也可以降级到 EF 6.0.2,它将再次开始工作。

在包管理器控制台中,输入:

Install-Package EntityFramework -Version 6.0.2

你应该可以走了。

但前提是 EF 6.0.2 适合您。祝你好运。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何让 Glimpse 与 EF6 一起使用? 的相关文章

随机推荐

  • AsyncTask 中的 ProgressDialog

    我试图在从 HTTP 服务器加载 RSS 提要时显示自定义进度对话框 我进行了艰苦的搜索 但没有任何帮助我做到这一点 我唯一知道的是该解决方案应该使用AsyncTask 但我对传递给它的参数感到困惑AsyncTask 这是我的活动 publ
  • Python中四分位距应该如何计算?

    我有一个数字列表 1 2 3 4 5 6 7 我想要一个函数来返回这个数字列表的四分位数范围 四分位数间距是上四分位数和下四分位数之间的差值 我尝试使用 NumPy 函数和 Wolfram Alpha 计算四分位数范围 我发现所有的答案 从
  • 错误:R Shiny 图的第一个参数无效

    我编写了一个 R 脚本来使用 R 来训练自己和其他人使用 Shiny 人们可以选择一个数据集并在基础图上绘制 x 和 y 变量 还有一些其他用户定义的参数 这一切都有效 但它也会引发 错误 第一个参数无效 这可以在 绘图 选项卡 在闪亮的仪
  • Python:计算 Pandas 中两列之间的 tf-idf 余弦相似度时出现 MemoryError

    我正在尝试计算 Pandas 数据框中两列之间的 tf idf 向量余弦相似度 一列包含搜索查询 另一列包含产品标题 余弦相似度值旨在成为搜索引擎 排名机器学习算法的 特征 我在 iPython 笔记本中执行此操作 不幸的是遇到了 Memo
  • 在 javascript 中替换多个
    替换为单个

    我想更换多个 br 带有单个的标签 br 在一段文字中 我的文字就像 p fhgfhgfhgfh p br br p ghgfhfgh p br br p fghfghfgh p br br p fghfghfgh p br br p fg
  • Haskell 有什么大惊小怪的? [关闭]

    就目前情况而言 这个问题不太适合我们的问答形式 我们希望答案得到事实 参考资料或专业知识的支持 但这个问题可能会引发辩论 争论 民意调查或扩展讨论 如果您觉得这个问题可以改进并可能重新开放 访问帮助中心 help reopen questi
  • XPath:通过当前节点属性选择当前和下一个节点的文本

    如果这是一个重复的问题 我很抱歉 但我在 SO 或其他地方找不到另一个问题来处理我需要的内容 这是我的问题 我在用着scrapy从中获取一些信息this http www utm utoronto ca regcal WEBLISTCOUR
  • 程序下载 - IE CHROME - “不常下载,可能很危险。”

    我有一个 C 程序的安装程序 我将其上传到我的网站 但每当我尝试在 chrome 或 IE 中下载它时 我都会收到 MY FILE 不常下载 可能很危险 只有单击小箭头并从菜单中选择 保留 才能保留它 只有十分之一的用户能够获取我的程序 我
  • AWS Api Gateway 使用消息属性连接到 SQS

    我已按照本教程连接了一个 Api 网关方法来推送到 SQS 队列 https dzone com articles creating aws service proxy for amazon sqs https dzone com arti
  • 使用 Django Rest Framework 测试 CSRF 验证

    我正在使用 Django Rest Framework 3 想测试 CSRF 验证 首先 我初始化 DRFAPIClient client APIClient enforce csrf checks True 然后我为用户设置密码 以便我可
  • React Native - 如何使用图像组件中的uri加载本地图像?

    我知道我们可以使用以下方法加载本地图像
  • 设置步长极坐标图 matplotlib python

    Currently i m making a polar plot in matplotlib Unfortionaly the step size is 10 like shown below How can i change the s
  • Adobe Flash 和 Python

    是否可以使用CPython http www python org 开发基于 Adob e Flash 的应用程序 你可以试试ming http www libming org 用于生成 Macromedia Flash 文件 swf 的库
  • 如何更改切换按钮的颜色? [复制]

    这个问题在这里已经有答案了 可能的重复 更改开关的 打开 颜色 https stackoverflow com questions 11253512 change on color of a switch 我需要有一个ToggleButto
  • Cin 没有操作数 >>

    我不明白为什么这不起作用 由于某种原因我收到错误 error C2678 binary gt gt no operator found which takes a left hand operand of type std istream
  • 如何使用 Elasticsearch 处理多个更新/删除?

    我需要更新或删除多个文档 当我更新时我这样做 我首先搜索文档 为返回的结果设置更大的限制 假设大小 10000 对于每个返回的文档 我修改了某些值 我对elasticsearch 整个修改列表 批量索引 感到不满 此操作将持续进行 直到点
  • 在共享库Jenkins Pipeline中使用CURL命令上传本地文件

    我正在尝试将文件从本地目录上传到远程目录 我编写了一个 Groovy 库来执行此操作 def file WORKPLACE BUILD NUMBER file txt pulic uploadArtifct String user Stri
  • 检测Python中的空函数定义

    我需要检测函数是否为空定义 它可以是这样的 def foo pass or like def foo i arg kwargs pass or like foo lambda x None 使用 检查 模块检测它们的最优雅的方法是什么 还有
  • 创建一个独立的离线 HTML5 应用程序以及嵌入其资源的最佳方法

    我正在尝试创建一个 HTML5 文档 该文档可以通过电子邮件发送给人们 其中包含运行它所需的所有标记 js css 和图像 我知道描述离线过程的文章 例如http diveintohtml5 info offline html http d
  • 如何让 Glimpse 与 EF6 一起使用?

    EDIT 在底部添加堆栈跟踪 我有一个 ASP NET MVC 5 项目 它通过 Entity Framework 6 使用 SQL Server 数据库 我将 Glimpse 和 Glimpse MVC5 添加到项目中 效果很好 但是 当