.Net MVC错误无法加载实体框架提供程序类型

时间:2014-04-16 01:40:57

标签: asp.net-mvc

人。我正在研究一个开源的MVC项目。但建成后(通过)。我得到了运行时错误。

Server Error in '/' Application.

The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

Source Error: 


Line 15: 
Line 16:        public MVCForumContext() : base("DefaultConnection") { }
Line 17:        public MVCForumContext(String nameOrConnectionString) : base(nameOrConnectionString) { }
Line 18: 
Line 19:        public DbSet<User> Users { get; set; }

Source File: c:\New folder\mvcForum.DataProvider.EntityFramework\MVCForumContext.cs    Line: 17 
你能给我一些指导吗?感谢。

2 个答案:

答案 0 :(得分:8)

检查数据库项目中的引用。 您应该列出EntityFramework和EntityFramework.SqlServer。 如果没有尝试卸载并重新安装EF nuget包,它对我有用。

答案 1 :(得分:0)

我得到了完全相同的错误,我通过将项目引用下面的复制本地属性设置为 True 来修复。

  • 的EntityFramework
  • EntityFramework.SqlServer