Supporting SQL Server 2012 AlwaysOn® in .NET Framework 4 (by Luiz Fernando Santos)

One of the most common questions I get from customers is which version of .NET supports SQL Server 2012 AlwaysOn® connectivity.  For those who are not familiar with SQL Server 2012, this is its new and exciting high availability feature.  In a nutshell, it enhances the capabilities of Database Mirroring by providing an integrated set of options including automatic and manual failover of a group of databases and by adding support to multi-site clustering across different subnets, which enables fast cross-datacenter failover.

AlwaysOn® also enables workload-based connectivity through SQL Server Availability Groups.  In this case, applications intending to connect in order to only retrieve data can be rerouted to read-only copies of the database in another server instance, called secondary, offloading the main one, called primary.  For more information on AlwaysOn®, please refer to https://go.microsoft.com/fwlink/?LinkID=232281&clcid=0x409)

From the application standpoint, AlwaysOn® does not require any special API.  The only requirement is a couple of new connection string keywords (ApplicationIntent and MultiSubnetFailover) in order to inform the application’s intent (ReadOnly or ReadWrite) and if the application is connecting to an AlwaysOn® Availability Group cluster.

More information on using these keywords can be found in MSDN, at https://go.microsoft.com/fwlink/?LinkID=242787&clcid=0x409.

On October 19th, 2011, Microsoft released the Update 4.0.2 for the Microsoft .NET Framework 4 (found at https://support.microsoft.com/kb/2544514), which includes support for AlwaysOn® connectivity.  If you want to use this new high availability feature of SQL Server 2012, you need to apply this update in order to properly set the new connection string properties to enable direct connectivity to secondary servers and to fast failover between availability group clusters.

Now, it’s very important to have in mind that this update is not required if you plan to connect to a regular DB Mirroring infrastructure or failover cluster or even to a standalone server.

Luiz Fernando Santos

ADO.NET PM