Fienix
Fienix

Reputation: 245

.Net Application not using Failover Partner in Connection String

I have SQL Mirroring setup on two SQL 2012 Standard Edition servers with a witness server. The mirroring works great on the SQL side of things, I can failover to each one just fine. The problem is my .Net applications aren't accessing the failover partner when I manually failover to the mirror server, they just keep trying to access the primary server and eventually timeout. I can see the connection attempts on the primary server in the SQL error log; the error being "Failed to the explicitly specified database" which makes sense because it is now the mirror and in the restoring state.

Here is my connection string:

connectionString="Server=x.x.x.x,[port];Failover Partner=x.x.x.x,[port];Database=[dbname];Network=dbmssocn;Integrated Security=SSPI;Connection Timeout=60;MultipleActiveResultSets=true"

I've tried the following things:

If I recycle the app pool right after failover, everything works great and I can even failover back to the primary instance and all is well. But if I have to manually recycle the app pool after a failover, it defeats the entire purpose of high-availability/automatic failover.

What am I missing here?

EDIT: I basically need to solve scenario 5 and 6 from this page: https://blogs.msdn.microsoft.com/spike/2010/12/08/clarification-on-the-failover-partner-in-the-connectionstring-in-database-mirror-setup/

Upvotes: 4

Views: 1656

Answers (1)

Fienix
Fienix

Reputation: 245

For anyone else having this problem. I switched my SQL instances back to using the default 1433 port and everything seems to be failing over perfectly.

Upvotes: 4

Related Questions