An Azure relational database service.
You cannot completely disable Auto-pause while keeping an Azure SQL Database on the specific Free Database offer. Auto-pause is an inherent part of how the Free offer provides its monthly free compute allocation. There is no setting that allows you to retain the Free offer while telling Azure SQL Database to remain continuously running.
What you are experiencing makes sense given the way your application starts. When the database is paused, the first database operation has to wait for Azure SQL Database to resume. If your ASP.NET Core application attempts to connect to or query the database as part of its startup process, that operation can time out or fail. The result can be an HTTP 500.30, ASP.NET Core app failed to start. Once the application process has failed, the fact that the database subsequently finishes waking up does not necessarily cause App Service to restart the application, which explains why manually restarting the App Service gets it working again.
A zero-cost solution would involve making the application tolerant of the database temporarily being unavailable rather than trying to disable Auto-pause. If you are using Entity Framework Core, for example, you can enable SQL connection resiliency with EnableRetryOnFailure:
options.UseSqlServer(connectionString, sqlOptions => sqlOptions.EnableRetryOnFailure(
maxRetryCount: 5,
maxRetryDelay: TimeSpan.FromSeconds(30),
errorNumbersToAdd: null));
This tells Entity Framework Core to retry transient SQL connection failures rather than immediately giving up. However, if your application performs mandatory database operations during ASP.NET Core startup, you may also need to change that startup code so that a temporarily unavailable database does not cause the entire application to terminate. Ideally, the web application should be capable of starting even when the database is still waking up and should retry the database operation afterward.
So, if your priority is keeping the project completely free, there isn't a configuration change that will give you a permanently running SQL Database under the Free offer. The better approach is to modify the application so that the delay caused by waking the database is treated as a temporary condition rather than a fatal startup failure. That also makes the application more robust in general, because databases can be temporarily unavailable for reasons other than Auto-pause.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin