无法找到请求的.NET Framework数据提供程序。它可能没有安装。 - 当以下MVC3 asp.net教程 [英] Unable to find the requested .Net Framework Data Provider. It may not be installed. - when following mvc3 asp.net tutorial

查看:201
本文介绍了无法找到请求的.NET Framework数据提供程序。它可能没有安装。 - 当以下MVC3 asp.net教程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下面的ASP.NET MVC 3音乐商店应用程序的教程,但我一直陷在第4部分:<一href=\"http://www.asp.net/mvc/tutorials/mvc-music-store-part-4\">http://www.asp.net/mvc/tutorials/mvc-music-store-part-4.它使告诉我,我没有安装SQL数据提供者的更多信息:

I am following the ASP.NET MVC 3 Music store application tutorial but I keep getting stuck in part 4: http://www.asp.net/mvc/tutorials/mvc-music-store-part-4. It keeps telling me that I do not have the SQL data provider installed:

完全错误:

System.ArgumentException was unhandled by user code
  Message=Unable to find the requested .Net Framework Data Provider.  It may not be installed.
  Source=System.Data
  StackTrace:
       at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
       at System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name)
       at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
       at System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel()
       at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
       at System.Data.Entity.Internal.InternalContext.Initialize()
       at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
       at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
       at System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator()
       at System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator()
       at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
       at MusicApplication.Controllers.StoreController.Index() in C:\Users\Michelle\documents\visual studio 2010\Projects\MusicApplication\MusicApplication\Controllers\StoreController.cs:line 18
       at lambda_method(Closure , ControllerBase , Object[] )
       at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
       at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
  InnerException: 

我已经加入了参考System.Data.SqlServerCe - 仍然有同样的错误。任何指导,将是真正的AP preciated

I have added the reference to System.Data.SqlServerCe - still have the same error. Any guidance would be really appreciated

推荐答案

我能够用的NuGet解决Visual Studio 2010中一个类似的问题。

I was able to solve a problem similar to this in Visual Studio 2010 by using NuGet.

转到工具>库软件包管理器>管理的NuGet软件包的解决方案...

Go to Tools > Library Package Manager > Manage NuGet Packages For Solution...

在该对话框中,搜索EntityFramework.SqlServerCompact。你会发现与描述一包允许的SQL Server Compact 4.0与实体框架一起使用。安装该软件包。

In the dialog, search for "EntityFramework.SqlServerCompact". You'll find a package with the description "Allows SQL Server Compact 4.0 to be used with Entity Framework." Install this package.

类似于以下的元素将在你的web.config中插入:

An element similar to the following will be inserted in your web.config:

<entityFramework>
  <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
    <parameters>
      <parameter value="System.Data.SqlServerCe.4.0" />
    </parameters>
  </defaultConnectionFactory>
</entityFramework>

这篇关于无法找到请求的.NET Framework数据提供程序。它可能没有安装。 - 当以下MVC3 asp.net教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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