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 8966703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:04:36+00:00 2026-06-15T17:04:36+00:00

When I create a new ASP.Net MVC 4 project with Visual Studio 2012 it

  • 0

When I create a new ASP.Net MVC 4 project with Visual Studio 2012 it puts the data in an mdf file in the project directory.

What I would like to do at this point is to migrate the database to an SQL Server instance gently, keeping all the scaffold stuff provided by the ASP.Net MVC 4 project template (I mean user accounts management etc.)

What would be the right step-by-step way to do this?

How exactly should I change the connection string?

How should I authentify my application in SQL Server in production?

Sorry for a dumb question but I haven’t dealt with ASP.Net applications before, in my previous experience (which was with WinForms) all the actual users had a separate SQL Server account and it was pretty straightforward.

  • 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-15T17:04:37+00:00Added an answer on June 15, 2026 at 5:04 pm

    The whole User Instance and AttachDbFileName= approach is flawed – at best! Visual Studio will be copying around the .mdf file and most likely, your INSERT works just fine – but you’re just looking at the wrong .mdf file in the end!

    The real solution in my opinion would be to

    1. install SQL Server – Express (and you’ve already done that anyway) or any other edition

    2. install SQL Server Management Studio (Express)

    3. create your database in SSMS Express, give it a logical name (e.g. YourDatabase)

    4. connect to it using its logical database name (given when you create it on the server) – and don’t mess around with physical database files and user instances. In that case, your connection string would be something like:

      Data Source=.\\SQLEXPRESS;Database=YourDatabase;User ID=AppUser;Pwd=Top$ecret
      

      and everything else is exactly the same as before…

    For deployment to production, you basically have a number of options:

    1. create deployment SQL scripts yourself and have them executed using sqlcmd or any other useful SQL script runner

    2. use a SQL diff tool like Red-Gate SQL Compare or even the built-in Visual Studio diff tool to determine difference between the database version installed at your client’s site, and the new version, and create a single upgrade SQL script from that diff

    3. use the Visual Studio Database Projects and let VS handle the upgrade scripts and deployments. VS database projects craft a model on top of your database – you basically only ever create the CREATE TABLE .... script and the VS tools figure out what needs to be altered, dropped, created fresh

    4. if you’re using Entity Framework code-first – look into using the EF code-first migrations to update your database from C# code

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

Sidebar

Related Questions

Using Visual Studio 2012, I created a new ASP.NET MVC 4 web project, using
I've created a new ASP.Net MVC 4 project in Visual Studio 2012 and figured
When one creates a new ASP.NET MVC project in visual studio, the New Project
When I create a New Project of type ASP.Net MVC Web Application, I expect
I'm not new to programming but am new to Visual Studio, MVC, C#, ASP.NET,
When I create a new ASP.NET MVC project two files with underscore are created:
I have a visual studio project which is an ASP.NET MVC project, however it
I have created the following project structure for my new asp.net mvc project any
Some background: I create a new ASP.NET MVC 3 WebApplication. Then I add a
I am new in MVC3. When i create a new default ASP.NET MVC 3

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.