I have a mirrored sql server db environment. A load balanced application hosted in IIS is accessing the databases. In Connection string I have mentioned FailOver partner. When I am performing fail over from db1 to db2 the application fails to connect.
The error that I received is:
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. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) at MyMethodName() at MyMethod() System.ComponentModel.Win32Exception (0x80004005): The network path was not found System.Data.SqlClient.SqlException (0x80131904): 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. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): The network path was not found.
Once I restart the application pool the application will be able to connect again to the db. My connection string would look like below.
<add name="SqlString" connectionString="Data Source=12.34.56.79,9100;Failover Partner=12.34.56.78,9100;Initial Catalog=test;Persist Security Info=True;User ID=####;Password=#####" />
I am using Sql server 2012, IIS 8.5, Windows Server 2012
Any help on this will be appreciated