Configuring Connection Failover
- Last Updated: April 16, 2026
- 1 minute read
- ADO.NET
- Documentation
-
Specify the primary and alternate servers:
-
Specify your primary server using a connection string.
-
Specify one or multiple alternate servers by setting the Alternate Servers connection string option.
See Guidelines for Primary and Alternate Servers for more information.
Note: If using failover with MSCS, which determines the alternate server for failover instead of the data provider, any alternate server specified must be the same as the primary server. For example:
SQLServerConnection Conn = new SQLServerConnection(); Conn = new SQLServerConnection("Host=Accounting1; Port=1433;Database Name=TEST;User ID=TEST;Password=TEST01; Alternate Servers="Host=Accounting1;Port=1433;Database Name=TEST"); -
-
Optionally, configure the connection retry feature. See Using Connection Retry.