1

I'm using aspnetboilerplate solution developed with ASP.NET core 2.2 . The backend is deployed on azure and it uses the SQL server provided.

Sometimes, when the backend has a lot of requests to handle, it logs this exception:

Mvc.ExceptionHandling.AbpExceptionFilter - An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseSqlServer' call. System.InvalidOperationException: An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseSqlServer' call. ---> System.Data.SqlClient.SqlException: A transport-level error has occurred when receiving results from the serv

I tried to solve this problem adding this code to my Startup.cs

public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            // MVC
            services.AddMvc(
                options => options.Filters.Add(new CorsAuthorizationFilterFactory(_defaultCorsPolicyName))
            ).AddJsonOptions(
            // To fix OldContract in Contract entity (self-referencing loop)

        services.AddDbContext<ManagerDbContext>(options =>
        {
            options.UseSqlServer(_appConfiguration["ConnectionStrings:Default"],
                sqlServerOptionsAction: builder =>
                {
                    builder.EnableRetryOnFailure(
                        maxRetryCount: 10,
                        maxRetryDelay: TimeSpan.FromSeconds(30),
                        errorNumbersToAdd: null);
                });
        });

    }

But the problem is not solved.

7
  • where do you build and deploy your project? Via Azure Pipelines or on your local machine? If you are using Azure Pipelines, please check if the problem also occurs when you try on local. Commented Dec 9, 2020 at 7:41
  • How are things going? Have you tried on your local? Does it work? Please try it, any progress, feel free to tell me. Thanks. Commented Dec 10, 2020 at 6:54
  • Yes sorry, i can't try it on my local environment because this appens only on azure when backend has a lot of requests (from a lot of users). And yes i use azure pipelines . I tried also to build locally and after deploy it manually on azure, but the problem occurs again. Commented Dec 11, 2020 at 12:09
  • I think it has mapping issue between the incoming request and the database object mapping. Hence transient error. Commented Dec 13, 2020 at 12:54
  • @C1X Have you managed to fix the problem? Commented Oct 4, 2021 at 10:52

1 Answer 1

0

you will have to add your error code in the list errorNumbersToAdd:

options.EnableRetryOnFailure(
        maxRetryCount: 3,
        maxRetryDelay: TimeSpan.FromSeconds(10),
        errorNumbersToAdd: new List<int> { Add your code here});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.