[SOLVED] Yet Another Unable to find the requested .Net Framework Data Provider. It may not be installed

Issue

I have an ASP.NET WebPages Website and am receiving the following error:

System.ArgumentException: ‘Unable to find the requested .Net Framework
Data Provider. It may not be installed.’

WebSecurity.InitializeDatabaseConnection("ALMSTEntities", "UserProfile", "UserId", "EmailAddress", autoCreateTables: true);

<DbProviderFactories>
  <remove invariant="System.Data.SqlServerCe.4.0"/>
  <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>

<connectionStrings>
    <add name="ALMSTEntities" connectionString="metadata=res://*/App_Code.Model.csdl|res://*/App_Code.Model.ssdl|res://*/App_Code.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\SQLEXPRESS;initial catalog=ALMST;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient"/>
</connectionStrings>

<providers>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>

I have searched tirelessly and tried numerous approaches to solving this. This error seems to be very common with many different answers but none of them have worked for me. This is not a duplicate, because all the other answers provided on this site, and others, have not resolved my issue.

How can I resolve this issue?

Solution

Replacing the connection string from the question with the following solved this for me:

<add name="ALMSTDB" connectionString="Data Source=DESKTOP-99CRCTP\SQLEXPRESS;Initial Catalog=ALMST;Integrated Security=True" providerName="System.Data.SqlClient"/>

using the following providers:

<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>

Answered By – Jay

Answer Checked By – Pedro (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *