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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:43:03+00:00 2026-05-20T14:43:03+00:00

I am writing my first .NET MVC application and I am using the Code-First

  • 0

I am writing my first .NET MVC application and I am using the Code-First approach. I have recently learned how to configure two SQL Servers installations for High Availability using a Mirror Database and a Witness (not to be confused with Failover Clusters) to do the failover process. I think this would be a great time to practice both things by mounting my web app into a highly-available DB.

Now, for what I learned (correct me if I’m wrong) in the mirror configuration you have the witness failover to the secondary DB if the first one goes down… but your application will also need to change the connection string to reference the secondary server.

What is the best approach to have both addresses in the Web.config (or somewhere else) and choosing the right connection string?

  • 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-05-20T14:43:04+00:00Added an answer on May 20, 2026 at 2:43 pm

    I have zero experience with connecting to Mirrored databases, so this is all heresy! 🙂

    The short of it may be you may not have to do anything special, as long as you pass along the FailoverPartner attribute in your connection string. The long of it is you may need additional error handling to attempt a new connection so the data provide will actually use the FailoverPartner name in the new connection.

    There seems to be some good information with Connecting Clients to a Database Mirroring Session to get started. Have you had a chance to check that out?

    If not, its there with Making the Initial Connection where they introduce the FailoverPartner attribute of the ConnectionString property attributes.

    Reconnecting to a Database Mirroring Session suggests that on any client disconnect due to failover, the client will need to trap this exception and be prepared to reconnect:

    The application must become aware of
    the error. Then, the application needs
    to close the failed connection and
    open a new connection using the same
    connection string attributes
    .

    If the FailoverPartner attribute is available, this process should be relatively transparent to the client.

    If the above doesn’t work, then you might need to actually introduce some logic at the application tier to track who is the primary node, the failover node, and connection strings for each, and be prepared to persist that information somewhere – much like the data access provider should be doing for us (eyes wide open).

    There is also this ServerFault post on database mirroring with Sql Server that might be of interest from an operational viewpoint that has additional reference information.

    Hopefully someone with actual experience will back up any of this!

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

Sidebar

Related Questions

When writing my first asp.net MVC application using C#, I see that there are
I'm writing my first asp.net mvc application and I have a question about custom
I am writing ASP.NET MVC application. When the user first logs in, the application
I'm writing an ASP.NET MVC site where I'm using LINQ to SQL to access
I'm writing my first Windows CE app using the .NET Compact Framework v3.5. I
I have an ASP.NET MVC application that uses LINQ2SQL as the database layer. I
I'm writing my first application with Zendframework. My question is about the Model–View–Controller (MVC)
Totally stupid question, but I'm writing my first ASP.NET C# web forms application and
I'm writing my first app with ASP.NET MVP (attempting Supervisory Controller) and Unit Testing
Writing my first Linq application, and I'm trying to find the best way to

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.