Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9005295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:06:23+00:00 2026-06-16T01:06:23+00:00

With VS 2010 SP1 I created an ASP.NET MVC4 project from the internet template.

  • 0

With VS 2010 SP1 I created an ASP.NET MVC4 project from the “internet” template. I then created a connection string for SQL Server CE 4.0:

<add name="DefaultConnection"
     connectionString="Data Source=|DataDirectory|MyDatabase.sdf;Password=123456" 
     providerName="System.Data.SqlServerCe" /> 

With the web application successfully debug-launched in cassini, I choose the “Register” user option. Immediately this causes the InitializeSimpleMembershipAttribute filter to execute. The filter crashes the site when it reaches this code:

Database.SetInitializer<UsersContext>(null);
using (var context = new UsersContext())
{
    if (!context.Database.Exists())
    {
        // Create the SimpleMembership database without Entity Framework migration schema
        ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
    }
}
//This line never executes.  It is meant to configure my custom user table.
WebSecurity.InitializeDatabaseConnection("DefaultConnection", "Users", "ID", "UserName", true);

The Exists() check throws an ArgumentException stating:

Unable to find the requested .Net Framework Data Provider. It may not be installed.

Now I wanted to be sure that (1) there was nothing wrong with my connection string and (2) there was nothing wrong with my provider. To do that, I inserted a snippet of code before the Exists() check. The snippet used a new SqlCeEngine to create the database, and Dapper calls to setup user tables. That code worked just fine, just before exploding on the Exists() check again.

I then considered that EF might need some additional setup help. I tried replacing the EF defaultConnectionFactory in my web.config:

<entityFramework>
  <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
    <parameters>
      <parameter value="System.Data.SqlServerCe.4.0" />
    </parameters>
  </defaultConnectionFactory>
</entityFramework>

Still the exception I received did not change.

I’m now wondering if EF needs a “special” connection string to work with SQL Server CE. I will be checking here and here. But at first glance I’m not sure that is the issue.

Thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:06:25+00:00Added an answer on June 16, 2026 at 1:06 am

    EF requires the providers to be installed.
    Use one the connect to DB options to check. eg ADD Entity DAta Model to Project. Just to the providers available to it. Do you see your preferred connection Client ?
    enter image description here

    Seems Compact edition should work with some restrictions…
    http://technet.microsoft.com/en-us/library/cc835494.aspx

    So then I think its The “DEFAULT CONNECTION” issue
    See the Context constructor. EF looks for a connection by that name unless you pass an alternative in.
    try…

    <connectionStrings>
        <add name="MyContextName" connectionString="bla";App=EntityFramework"
           providerName="System.Data.SqlServerCe.4.0" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to The Gu, in VS 2010 SP1 (http://weblogs.asp.net/scottgu/archive/2011/01/11/vs-2010-sp1-and-sql-ce.aspx) I should be able to
I have an ASP.NET MVC 3 project that I just created using the project
Using Visual Studio 2010 SP1, SQL server 2008: Motherboard recently failed and I migrated
Just recently upgraded to Visual Studio 2010 SP1 and ASP.NET MVC3, but the only
I’ve created a new C# asp.net mvc 4.0 (beta) Internet Application and I’m having
Using ASP.NET MVC 3.0 with Visual Studio 2010 (Pre-SP1 and with SP1) and ASP.NET
I have installed the sp1 for visual studio 2010 and installed sql server ce
I have upgraded our TFS 2010 (Win 2008 R2 SP1, SQL Server 2008 R2
I have created an EDMX in visual studio 2010 SP1. It has been built
I installed Chirpy under VS 2010 SP1, created a small all.chirp.config and saved it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.