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 7706407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:07:06+00:00 2026-06-01T00:07:06+00:00

I use following code: Create a retry policy, when error, retry after 1 second,

  • 0

I use following code:

Create a retry policy, when error, retry after 1 second, then wait 3 seconds, then 5 seconds. based on Azure SLA, retry within 10 seconds must success (No throttled, I sure this. because error even happens on unique partition and table which no traffic yet)

var retryStrategy = new Incremental(3, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2));
var FaultHandlingRetryPolicy = new RetryPolicy<StorageTransientErrorDetectionStrategy>(retryStrategy);

Then I use this code to get data

FaultHandlingRetryPolicy .ExecuteAction(() =>
        {
            var results = (from q in Query select new q).ToList();
        });

I DO NOT KNOW if its retried or not, because the error log not shown

Errors:

System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 70.37.127.112:443
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetResponse()
   at System.Data.Services.Client.QueryResult.Execute()
   at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
   at System.Data.Services.Client.DataServiceQuery`1.Execute()
   at System.Data.Services.Client.DataServiceQuery`1.GetEnumerator()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.Practices.TransientFaultHandling.RetryPolicy.<>c__DisplayClass1.<ExecuteAction>b__0()
   at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)

Please let me know if this code will retry, thanks

  • 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-06-01T00:07:07+00:00Added an answer on June 1, 2026 at 12:07 am

    When you setup a retry policy, you specify the class that will control the retires, in your case it is StorageTransientErrorDetectionStrategy.

    Each time an exception is thrown inside the ExecuteAction() method, this class will decide if a retry is possible or not. For instance some exceptions are transient, so it’s not worth retrying them.

    To actually track the number of retries, you can use code like this:

    FaultHandlingRetryPolicy.Retrying += (obj, eventArgs) =>
                {
                    Console.Writeline("Retrying, CurrentRetryCount = {0} , Exception = {1}", eventArgs.CurrentRetryCount, eventArgs.LastException.Message);
                };
    

    Update

    You can create your own error handling strategy like so and use it in-place of the standard one. BUT you’ll have to tune the errors to fit with your scenario, these worked for me.

        public class CustomSqlAzureTransientErrorDetectionStrategy : ITransientErrorDetectionStrategy
        {
            private readonly SqlAzureTransientErrorDetectionStrategy _normalStrategy =
                new SqlAzureTransientErrorDetectionStrategy();
    
            public bool IsTransient(Exception ex)
            {
                if (_normalStrategy.IsTransient(ex))
                    return true;
    
                //do our custom logic
                if (ex is SqlException)
                {
                    var sqEx = ex as SqlException;
                    if (sqEx.Message.Contains("The timeout period elapsed prior to completion of the operation or the server is not responding") ||
                        sqEx.Message.Contains("An existing connection was forcibly closed by the remote host") ||
                        sqEx.Message.Contains("The service has encountered an error processing your request. Please try again") ||
                        sqEx.Message.Contains("Timeout expired") ||
                        sqEx.Message.Contains("was deadlocked on lock resources with another process and has been chosen as the deadlock victim") ||
                        sqEx.Message.Contains("A transport-level error has occurred when receiving results from the server"))
                    {                        
                        return true;
                    }
                }
    
                return false;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the following code to create a new SalesInvoice based on
I use the following code to create countdowns in Javascript. n is the number
I use the following code try to create an array of string vectors, I
I use the following code to create a folder mymir and a file .nomedia
We currently use the following code to create an email in Outlook so that
I know that to create a file in c++ we use following code #include
I use the following code in the FormCreate event handler to create a system
I'm trying to use the following code to create a zip file from a
I am trying to use the following code to create a list of client
I use the following code to create a zip file: var files = Directory.GetFiles(targetPath);

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.