I'm getting the following error message when attempting to connect to the AZURE hosted bank through a WEB application:
An exception has been raiset that is likely due to transient failure. If you are connecting to Sql Azure database, consider using SqlAzureStrategy.
I disabled the bank's firewall to see if this could be the problem, but it did not resolve.
I am able to connect through SQL Server Management Studio, but not through the application.
The application connects to a bank through EF6
var usuario = Db.Usuario.Where(x => x.Login == login).FirstOrDefault();
if (usuario != null && usuario.ProfissionalID.HasValue)
{
usuario.Profissional = Db.Profissional.Where(x => x.ProfissionalID == usuario.ProfissionalID).FirstOrDefault();
}
return usuario;
I saw in a Microsoft article to implement this code snippet to solve the problem:
public class DbContextConfiguration : DbConfiguration
{
public DbContextConfiguration()
{
SetExecutionStrategy(
"System.Data.SqlClient",
() => new SqlAzureExecutionStrategy(1, TimeSpan.FromSeconds(30)));
}
}
I did this, but it seems to me that he makes several connection attempts to each, until one is successful.
But it seems to me that the server is unstable, since I could not get a connection, using SqlAzureExecutionStrategy.
Now I've received another error message:
Maximum number of retries (1) exceeded while executing database operations with 'SqlAzureExecutionStrategy'.