-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MDS 4.0+ Fails in .NET 4.8 when using AG (FailoverPartner) #1594
Comments
Hi @cmeyertons, I'll take a look since I did merge to this file into the shared src codebase. |
@cmeyertons where did you provide the failover partner? |
We are not providing the failover partner in our connection string, just the Data Source and Initial Catalog. Our data source is the the direct server name, not AG listener, due to some quirks in how our setup in our networking setup (I will try to figure out some more details on why this is) -- I know in a failover scenario, we will have to manually failover the server name. That aside, our setup should work -- it is fine in our code base using System.Data.SqlClient -- this behavior only crops up in MDS. |
@lcheunglci @JRahnama well I discovered a very hack-y workaround... var csb = new Microsoft.Data.SqlClient.SqlConnectionStringBuilder()
{
DataSource = db.ServerName, // the raw server name, not AG listener
InitialCatalog = db.DBname,
TrustServerCertificate = true,
IntegratedSecurity = true,
FailoverPartner = string.Empty, // <- HACK: workaround
}; |
@cmeyertons, glad to hear you have a workaround 👍🏽 . |
Also experiencing this on AWS RDS instances in multi-az mode - not sure how they have it set up but it seems to be the same issue. After testing, it seems you can apply @cmeyertons's workaround through the connection string by appending the following: |
Closing this as the PR #1614 was merged. Feel free to comment or open a new issue if you are still experiencing the problem. |
Describe the bug
A clear and concise description of what the bug is.
If you are seeing an exception, include the full exceptions details (message and stack trace).
It looks like we are checking for existence of the FailoverPartner keyword by trying to access a dictionary and seeing if it returns null here?
To reproduce
Expected behavior
Should be able to connect when database is in an AG.
Further technical details
Microsoft.Data.SqlClient version: 4.0
.NET target: net48
SQL Server version: SQL Server 2019
Operating system: Windows 2019
The text was updated successfully, but these errors were encountered: