Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6331767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:08:02+00:00 2026-05-24T18:08:02+00:00

My Azure role grabs stuff to process from a database – it holds an

  • 0

My Azure role grabs stuff to process from a database – it holds an instance of System.Data.SqlClient.SqlConnection and periodically creates an SqlCommand instance and executes an SQL query.

Now once in a while (usually once in several days) running a query will trigger an SqlException exception

The service has encountered an error processing your request. Please try again. Error code 40143.
A severe error occurred on the current command. The results, if any, should be discarded.

Which I’ve already seen many times and now my code catches it, calls Dispose() on the SqlConnection instance and then reopens the connection and retries the query. The latter typically results in another SqlException exception

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

Which looks pretty much like SQL Azure server not responding or being unavailable for whatever reason.

Currently my code doesn’t catch the latter exception, it is propagated outside RoleEntryPoint.Run() and the role is restarted. Restart typically takes about ten minutes and once it completes the problem is gone for a day or so.

I don’t like my role restarting – it’s takes a while and my service functionality is hindered. I’d like to do something smarter.

What would be a strategy to address this problem? Should I retry the query several times and how many times and with what interval? Should I do something else? When do I give up and let the role just restart?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:08:03+00:00Added an answer on May 24, 2026 at 6:08 pm

    I would strongly recommend you have a look at the Transient Fault Handling Framework for SQL Azure

    This will help you handle retry logic for both connection and query attempts, I am using this in production and it works great. There is also a nice article on technet that might be of some use.

    [EDIT: 17 Oct 2013]

    It looks like this has been picked up by the patterns and practices team at The Transient Fault Handling Application Block

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When a Windows Azure worker role instance is rebooted from within the Azure portal,
I've created an ADO.Net WCF Data Service hosted in a Azure worker role. I
Working with Azure web role that communicates to a SQL Azure database. Currently when
I'd like to view the logfile from an Azure worker role which uses this:
I have a simple work role in azure that does some data processing on
I want my Azure role to reprocess data in case of sudden failures .
I have a c++ dll running on azure instance role with no problems. I
I have an Azure Worker Role set up to get information from a few
I published a Azure Web Role from Visual Studio and something went wrong. I
We have a requirement to read an excel sheet from the Azure worker role.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.