Unable to find the requested .Net Framework Data Provider. It may not be installed. - when following mvc3 asp.net tutorial(无法找到请求的 .Net Framework 数据提供程序.它可能没有安装.- 在遵循 mvc3 asp.net 教程时)
问题描述
我正在关注 ASP.NET MVC 3 音乐商店应用程序教程,但我一直卡在第 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:UsersMichelledocumentsvisual studio 2010ProjectsMusicApplicationMusicApplicationControllersStoreController.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 的引用 - 仍然有同样的错误.任何指导将不胜感激
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 教程时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:无法找到请求的 .Net Framework 数据提供程序.它可能没有安装.- 在遵循 mvc3 asp.net 教程时
基础教程推荐
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01