High Availability in ASP.NET application

From Wikipedia,

High availability is a system design approach and associated service implementation that ensures a prearranged level of operational performance will be met during a contractual measurement period.

And it could include multiple database and application server connected in a clustered environment with redundant hardware. One of the method to make ASP.NET application available even if one server goes down it so make your application connect to secondary db server in the even of failure to connect to first server.

This post is to show this concept. (I am not very proud of my programming skills and I prepared this demo app in 15 mins, to please bare with me)

This simple app connects to one DB and if it fails (or gets timeout) it connects to second db. I am using SQL Authentication and this table is same on both Servers.

 <connectionStrings>
    <add name="DBConn1" connectionString="Server=Pockerface;Database=TestDB;User ID=userFoo;Password=userfoo;"/>
    <add name="DBConn2" connectionString="Server=Pockerface\Secondbase;Database=TestDB;User ID=userFoo2;Password=userfoo;"/>    
  </connectionStrings>

This is just a concept to show how can we make ASP.NET application to connect to another instance of database if it cant connect to first database.

I’ve uploaded whole project here.

That’s it for now.

It’s Just A Thought … Peace

Gaurang Sign

Leave a Reply

Your email address will not be published. Required fields are marked *