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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:06:56+00:00 2026-06-08T03:06:56+00:00

I am trying to create a database using code-first approach. When I am running

  • 0

I am trying to create a database using code-first approach. When I am running the following code I am getting the following exception. How can we overcome this?

Notes:

  • I have SQL Server 2008 R2 on my system.
  • I am not using any config file. I assumed that it will create database using conventions
  • There is no open connection already; I just restarted the system and tested. Still the same issue.
  • Runtime version for EntityFramework.dll is v4.0.3xxx

Exception:

The provider did not return a ProviderManifestToken string

Message :

This operation requires a connection to the ‘master’ database. Unable
to create a connection to the ‘master’ database because the original
database connection has been opened and credentials have been removed
from the connection string. Supply an unopened connection.

Inner Exception:

A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: Named
Pipes Provider, error: 40 – Could not open a connection to SQL
Server)

Code:

using System.Data.Entity;
namespace LijosEF
{
  public class Dinner
  {
      public int DinnerID { get; set; }
      public int Title { get; set; }
  }

  public class RSVP
  {
    public int RSVPID { get; set; }
    public int DinnerID { get; set; }

    public virtual Dinner Dinner { get; set; }
  }

  //System.Data.Entity.DbContext is from EntityFramework.dll
  public class NerdDinners : System.Data.Entity.DbContext
  {
    public DbSet<Dinner> Dinners { get; set; }
    public DbSet<RSVP> RSVPs { get; set; }
  }
}

namespace LijosEF
{
class Program
{
    static void Main(string[] args)
    {
        using (var db = new NerdDinners())
        {
            var product = new Dinner { DinnerID = 1, Title = 101 };
            db.Dinners.Add(product);
            int recordsAffected = db.SaveChanges();
        }

    }
}
}
  • 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-08T03:06:57+00:00Added an answer on June 8, 2026 at 3:06 am

    Without any connection information. EF will try to create the database in SQL Express and not SQL Server. If you want it created in SQL Server you will need to provide a connection string.

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

Sidebar

Related Questions

I'm trying to create a billing database with Entity Framework 4.3 using Code First
I am getting strange errors while trying to create a simple database using isql
I am trying to create dynamic menus from the database using the following example
I am successfully creating database (SQL Ce) using Entity Framework Code First approach (C#-WPF).
I'm trying to get Entity Framework Code First to create a database for me
I am trying to write a project using the code-first approach and I have
So I'm very new to this and I'm trying to create a database using
I am trying to create a database with a many-to-many relationship using EF code
I'm using Entity Framework Code First. The class i'm trying to create contains two
I am trying to create a database deadlock and I am using JUnit. I

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.