错误的相信信息如下描述:
An exception of type ‘System.InvalidOperationException’ occurred in mscorlib.dll but was not handled in user code
Additional information: 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.
截图如下
查看项目引用,发现少了对应的DLL
查看bin目录下,确实少了DLL文件
解决方法:只添加 EntityFramework.SqlServer.dll 即可