Provide way to set resiliency options
With SQL Azure in general and now specifically with the new serverless option it would be great to be able to enable the various ADO.NET and EF Core resiliency options so that you do not get a timeout on startup or when there is a transient failure. Both are just settings for number of times to retry, the retry interval, etc.
For EF Core with SQL you can use something like
optionsBuilder.UseSqlServer(cstr,
sqlServerOptionsAction: sqlOptions =>
{
sqlOptions.EnableRetryOnFailure(
maxRetryCount: 18,
maxRetryDelay: TimeSpan.FromSeconds(5),
errorNumbersToAdd: null);
})
In ADO.NET you can do it in the connection string parameters
ConnectRetryCount=18;ConnectRetryInterval=5;Timeout=90
Thank you
-
Donald commented
Transient DB connection issues are expected and as mentioned EF includes ways to set the retry and timeout options. We have moved to a VM in Azure and have higher transient connection failures than before which we have overcome in our software package with retry logic, but this cannot seem to be enabled in our queries.
-
Anonymous commented
The error you will get in LINQPad when resuming an Azure SQL Serverless database is something like:
Connection Timeout Expired. The timeout period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=33; handshake=110; [Login] initialization=0; authentication=0; [Post-Login] complete=14009;
If you wait about 60 seconds and try again you should no longer get the error.