Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in Azure by (45.3k points)

When I am querying from database in continuous looping, after some time I get an error :

An exception has been raised that is likely due to a transient failure. If you are connecting to a SQL Azure database consider using SqlAzureExecutionStrategy.

Normally it is working fine.

1 Answer

+1 vote
by (16.8k points)

While using the EF Core configure, try to retry on the failure for resilient connections :

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

{

    optionsBuilder.UseSqlServer("your_connection_string", builder =>

        {

            builder.EnableRetryOnFailure(5, TimeSpan.FromSeconds(10), null);

        });

    base.OnConfiguring(optionsBuilder);

}

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...