AppBeat Blog

Perfect Monitoring for Your Cloud

Tip: Azure SQL Database and transient errors

If you are using Azure SQL Database you may occasionally experience following exception (this is example throw by native SqlClient library):

System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.  This failure occurred while attempting to connect to the routing destination.

What is this? 

Azure system may occasionally quickly shift hardware resources to better load-balance various workloads. During this reconfiguration time span, you may have connectivity issues to Azure SQL Database. If this happens, your client can receive transient error (transient fault).

How do you handle this?

 If you are using .NET Framework 4.6.1 or later you can simply update your connection string, without touching your code.

Simply add following to your connection string:

ConnectRetryCount=VALUE1_IN_SECONDS;ConnectRetryInterval=VALUE2_IN_SECONDS;Connection Timeout=VALUE3_IN_SECONDS;

where VALUE1_IN_SECONDS is number between 0 and 255, VALUE2_IN_SECONDS is number between 1 and 60, VALUE3_IN_SECONDS is number between 0 and 2147483647.

It is recommended that you set Connection Timeout to: ConnectRetryCount * ConnectionRetryInterval (in our case VALUE3_IN_SECONDS = VALUE1_IN_SECONDS * VALUE2_IN_SECONDS). It is not recommended to set this value to 0 because this indicates no limit (connect waits indefinitely).



How to monitor your website with AppBeat?

Once you have logged-in to your AppBeat account  (you can create new account here and we offer also free plans), please click “Add new check” button:

This will open “New check” dialog. Now simply enter your friendly name and ensure that “Web site – check response from web server” is selected in “Agent type” section. Then click “Continue to Step 2” button:

On next step you have to enter URL of web site that you want to periodically check. Finish wizard by clicking “Add” button:

Congratulations! You have just added your first website check.