错误 0152: 未找到具有固定名称“System.Data.SqlClient”的 ADO.NET 提供程序的实体框架提供程序。请确保在应用程序配置文件的“entityFramework”节中注册了该提供程序。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?
在web.config中添加
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type ="System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer"/>
</providers>
</entityFramework>
并添加EntityFramework和EntityFramework.SqlServer的引用。
添加后报错:无法读取配置节“entityFramework”。
在web.config添加
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework"
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
加在上一段配置的前面。