No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0'. Make sure the provider is registered in the 'entityFramework' section of the application config file

In this post you will see resolution to fix error given below:

Server Error in '/' Application.

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.



This error may raise because of many reasons, you should try following solutions:

Solution 1

Make sure you have used System.Data.SqlServerCe.4.0 provider, as given below:

  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
    </providers>
  </entityFramework>


Solution 2

If above not helps, you should try this in package manager console:

     |||  Install-Package EntityFramework.SqlServerCompact -Version 6.1.1

In the above code -Version 6.1.1 may be something else, verify the latest version here http://www.nuget.org/packages/EntityFramework.SqlServerCompact


Also make sure you have valid connection string settings in Web.Config:

<connectionStrings>
   <add name="InvoiceDB" connectionString="Data Source=|DataDirectory|\InvoiceDB.sdf" providerName="System.Data.SqlServerCe.4.0" />
    :::::::::::::
</connectionStrings>


Hope this helps.

Comments

  1. installing the entity framework helped in my case/.. thanks.,

    ReplyDelete

Post a Comment

Popular posts from this blog

Migrating database from ASP.NET Identity to ASP.NET Core Identity

Customize User's Profile in ASP.NET Identity System