ASP.NET SQL Server Tips

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.

    <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;"/>    

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

By Gaurang

First thing I would like to write is a question .... Why the hack people write their bio in 3rd person ?

I am Gaurang. I work as DBA / DEV for local company in CT. When I am not working, I am either reading other blogs n news OR "researching" / "experimenting" about things that I can do at home / at work OR tinkering with some new hardware/software OR playing games on my desktop.

If you ever wanted to contact me, I can be reached by

Leave a Reply

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