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

可以强迫部署EntityFramework.SqlServer.dll这个文件到输出目录

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

找到1个老外的帖子,戳这里(本人测试无效,大家有可能试一下。。)

解决方案以下:

在EF的上下文代码CS文件(Model1.Context.cs)中添加这个方法

public void FixEfProviderServicesProblem() { //The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' //for the 'System.Data.SqlClient' ADO.NET provider could not be loaded. //Make sure the provider assembly is available to the running application. //See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. var instance = System.Data.Entity.SqlServer.SqlProviderServices.Instance; }
上一篇:docker 私有仓库搭建


下一篇:【CF刷题】14-05-12