I have developed a Web Application a standard web application to allow users to display and update a set of data from an SQL database.
The Web Application uses a An
15 minutes is too short for your app to be recycled (as suggested by CSharpRocks). I dont think its the issue here.
The delay is because a new Db connection is established upon first call after idle timeout. Typically if a connection is inactive for 4-10 minutes it will be closed. If a minimum pool size is specified, those connections will be kept alive even after idle timout expires.
Try using this connection string (adjust min pool size as per your needs)
<add name="DevFEConnectAdo" connectionString="data
source=feeunsqldevfeconnect.database.windows.net;initial
catalog=feeunsqldbdevfeconnect;persist security info=True;user id=???
@???;password=???;multipleactiveresultsets=True;Min Pool Size=3;Load Balance Timeout=180;"></add>
Further details Why do we need to set Min pool size in ConnectionString
List of SQL Connection Properties - documentation
Web apps are recycled after a few minutes of inactivity. Try enabling the Always On setting located in Settings/Application Settings in the portal to see if this helps with your issue.
After some time, this eventually got resolved with some help from Microsoft Azure support.
The detail that I left out was that my Web App was actually pointing to 2 databases - 1 the Application Azure SQL database, I was having the delay problem with - A 'Data Warehouse' we had on an Azure Virtual Machine
Because of replication between inhouse database servers and the 'Data Warehouse' the Virtual Machine and Web App were all in a Azure Virtual Network.
The problem was there can be network problems if a Web App inside a Virtual network wants to talk to Azure SQL Databases (which cannot be within a Virtual Network).
My solution was to
At this point all the delays went away and I could take off the MinPool Size settings (and Timeout which I later discovered did nothing anyway).