Azure SQL unavailable to Web App intermittently

63 views Asked by At

I have a webapp running in Azure. It uses a Azure MSSQL database set to Standard S0: 10 DTUs performance. The backend is written in dot net core 3.1. The app works fine when I visit it.

Checking my logs I found a few of these, they happen weeks apart at odd times.

Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 35 - An internal exception was caught)

This error has me wondering if some random user is unable to access the site because the SQL server won't respond.

Any suggestions as to what this might be about? Or suggestions as to what I should try doing?

Update 1: As a response to comment regarding retry. I actually have implemented retry on the connection (.net core entity framework) using this code.

services.AddDbContext<ApplicationDbContext>(
    options =>
    {
        options.UseSqlServer(connectionString, sqlOptions =>
        {
            sqlOptions.EnableRetryOnFailure(
                maxRetryCount: 10,
                maxRetryDelay: TimeSpan.FromSeconds(10),
                errorNumbersToAdd: null
            );
        });
        options.EnableSensitiveDataLogging(true);
    },
    ServiceLifetime.Transient
);
0

There are 0 answers