1. 程式人生 > >未找到具有固定名稱System.Data.SqlClient的ADO.NET提供程式

未找到具有固定名稱System.Data.SqlClient的ADO.NET提供程式

出現這個問題的原因是因為未新增Entity Framework 的引用或缺失配置檔案;

1:新增EntityFramework.SqlServer.dll引用;

2:web.config裡新增EF相關配置:

 <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" requirePermission="false" />
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>