while the underlaying ado library can auto reconnect, it will still throw an error. your error handling code should do the proper cleanup and retry. the complexity of this depends on the transaction logic. the recovery logic should be similar to handling a deadlock which your code can always get.
How to connect SQL server instance (Always on) with EF6.4 (.NET framework 4.8 Application in C#)
I am using Entity framework 6.4 (C# application) to connect SQL server database(always on) via availability group listener. I found that my application will throw exception when SQL server proceed failover from primary SQL instant to secondary instant. My questions are: Q1. Any connection string setting is needed to add for always on SQL server instance? Q2. Any best practice for Entity framework to connect SQL Server with always on? Thanks
1 additional answer
Sort by: Most helpful
-
Olaf Helper 45,811 Reputation points
2024-01-12T07:06:37.4266667+00:00 I found that my application will throw exception when SQL server proceed failover
Physical client connections can't be moved to secondary on a failover, the application have to re-connect.