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

  • Home
  • SEARCH
  • 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 8212723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:51:33+00:00 2026-06-07T10:51:33+00:00

I have a ASP.NET MVC 4 project – CodeFirst with Entity Framework – that

  • 0

I have a ASP.NET MVC 4 project – CodeFirst with Entity Framework – that was connected to a SQL Server Express database generated by EF and it was working just fine.

However, I am trying to deploy to AppHarbor and having some issues with the version of SQL running there connecting with my app.

So, I noticed that they have an example project that is utilizing SQL Server Compact Edition 4. Here is the web.config file for that project: https://github.com/friism/CodeFirstMigrations/blob/master/Web/Web.config

Also, I found a tutorial about how to include a SQL Server CE database in your project on Microsoft’s ASP.NET site: http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-4

I decided to create a FranchiseManagerData.sdf file in my App_Data folder and modify my connection string and app settings to match theirs. Here’s what my Web.config looks like:

<appSettings>
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>

  <connectionStrings>
    <add name="FranchiseManagerEntities"
         connectionString="Data Source=|DataDirectory|FranchiseManagerData.sdf"
         providerName="System.Data.SqlServerCe.4.0"/>
  </connectionStrings>

When I run my application, I get a DataException error that says: The underlying provider failed on Open.

It looks like what is happening is that the application is still looking for the old database that was generated by Entity Framework that had the name: FranchiseManagerTest.Models.FranchiseManagerContext – EF was naming it after my data context class.

Here is the error that is displayed after stopping debugging:

 Cannot open database "FranchiseManagerTest.Models.FranchiseManagerContext" requested by the login. The login failed.
Login failed for user 'COMPANY\UserName'.

I have tried cleaning and rebuilding the solution. Also, I’ve deleted the contents of the bin folder and did a clean rebuild again, however, it still seems to be looking for the old database connection.

What am I doing wrong? How can I get my project to look for the local SQL Server CE database I made and not the previous database?

If I need to supply any further details please let me know.

Thanks in advance.


EDIT

Here is a portion of the System.Web section of my Web.config file:

<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off"></customErrors>
<authentication mode="Forms">
  <forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
  • 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-07T10:51:36+00:00Added an answer on June 7, 2026 at 10:51 am

    FormsAuthentication doesn’t by default have the ability to use Sql CE (to my knowledge).
    I have used EJ’s SQL Server Compact 4.0 ASP.NET Membership provider without any issues.

    Also, it sounds like you’ll have to update your Entity Framework connection to use the SQL Server CE database correctly.

    Update

    As of .Net 4.5, the new SimpleMemembership Providers and Univerasl Providers naively support Sql CE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET MVC project that uses a SQL Server Compact database. I
We have an ASP.Net MVC project that will start with a single web server
I have an Asp.net MVC project that modestly uses jQuery scripts. My views also
I have a ASP.NET MVC 4 project and a SQL View (vvItem). ItemController MVCAppEntities
I have asp.net mvc 4 web application project on my server in IIS Directory.
I have an asp.net mvc project, and a function that streams out an image
I have an ASP.NET MVC project that works fine on my local machine (no
I have an ASP.NET MVC project that I'd like to install somewhere using xcopy
I have an ASP.NET MVC 2 project that I'm working on and I'm wondering
in my asp.net MVC project i have an database connection with connectionstring: Data Source=.;Initial

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.