No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'.

后端 未结 10 2019
旧巷少年郎
旧巷少年郎 2020-12-09 14:37

We are using EntityFramework 6 with Code First. We have a console app that has no reference to EntityFramework but reads the connection string from its App.config. It call

相关标签:
10条回答
  • 2020-12-09 15:27

    Add "EntityFramework.SqlServer.dll" into your project bin folder will resolved your issue.

    0 讨论(0)
  • 2020-12-09 15:30

    This is because EntityFramework.SqlServer.dllis not copied into your project. Add that dll and it will hopefully work.You can find that from the project where you added datamodel.

    0 讨论(0)
  • 2020-12-09 15:37

    I also had a similar problem

    My problem was solved by doing the following:

    0 讨论(0)
  • 2020-12-09 15:38

    For me it turned out that my provider reference in the web.config file was incorrect. I believe that the nuget package might not properly include the provider.

    I replaced my provider with this and it worked:

      <entityFramework>
          <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
          <providers>
              <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
          </providers>
      </entityFramework>
    
    0 讨论(0)
提交回复
热议问题