Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
1 view
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);

}

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...