Azure SqlException: Database on server is not currently available

asp.net azure azure-sql-database dapper

Question

Our site has been running for a few weeks in Azure without getting this error:

SqlException: Database 'database' on server 'server' is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of 'guid'.

It finally got that one day when there were a little over 2K of active (concurrent) users. This is the closest question that I can find in SO. We are not using EF though but rather we're using Dapper. I'm out of ideas how to debug our application to find out what caused the issue, and it's even harder now that the issue has not come up for the past 2 days. I definitely need to be on the lookout and I need you guys, any tip, on where I should be looking into, what I need to do to determine the cause of the issue, and possibly fix it.

Popular Answer

It sounds like you need to handle transient failures via some sort of transient fault handling mechanism. Here is post asking a similar question: SQL Azure Database retry logic David's answer is similar to the approach we took do deal with the issue.

Here is another link to some code that is similar to the David's and our solution to get your head around it. http://www.getcodesamples.com/src/4A7E4E66/41D6FAD

We had similar issues when we first moved to SQL Azure but by implementing back-off retry logic for the transient connection issues the majority of the time it recovers after a few seconds.



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why