Reputation: 83
My connection string looks as follows:
<add name="CONN_STRING" connectionString="Data Source=Listener1,28589;MultiSubnetFailover=True;Initial Catalog=DataDB;Persist Security Info=True;User ID=xxxxxx;Password=xxxxxx" providerName="System.Data.SqlClient"/>
When I use Listener1 which has 1 active ip, it works fine. But when I use Listener2 which has 2 nodes (1 active, 1 inactive),it doesn't work.
My initial guess was that my application was using old libraries to make the connection. But the application works on a different machine.
Application is targeting .net 4.5.1 framework. And both machines have 4.6.2 installed. Is there anything else that I need to change?
This is the error I get when it doesn't work.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
Upvotes: 1
Views: 18313
Reputation: 148
Multi-Subnet-Fail-Over represents the possibility to cross the subnet in the database connection. Windows Server 2008 or later and SQL server 2012 is required because they have a logical OR sequence and use the AlwaysON AG configuration. Windows 2003 and SQL server 2008 have a logical AND sequence and to be functional they need the clustered resource to remain online. See doc Microsoft at: https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/listeners-client-connectivity-application-failover?view=sql-server-2017#SupportAgMultiSubnetFailover
Upvotes: 3