Transient Fauld Handling and simple Process

Topics: Enterprise Library Core
Jul 11, 2012 at 12:37 PM


I wanted to use the transient fault application handling and a simple Process launching a exe.

Is it possible ?

Has anyone any example of that ?


var process = Process.Start(startOptions);




Jul 12, 2012 at 6:48 AM

I'm not sure I understand what you are trying to accomplish.  Are you trying to use the Transient Fault Handling Block outside of Azure?  If so, then yes you can use it.  You will have to write your own strategies and configure the block using code.

For example, you could create a SQL Deadlock detection strategy and use that:

    public class SqlDeadlockStrategy : ITransientErrorDetectionStrategy
        public bool IsTransient(Exception ex)
            var sqlException = ex as SqlException;
            return sqlException != null && sqlException.Number == 1205;

    var retryStrategy = new Incremental(5, TimeSpan.FromMilliseconds(1000), TimeSpan.FromMilliseconds(1000));

    var retryPolicy = new RetryPolicy<SqlDeadlockStrategy>(retryStrategy);

    // Receive notifications about retries.
    retryPolicy.Retrying += (sender, arguments) =>
        // Log details of the retry.
        var msg = String.Format("Retry - Count:{0}, Delay:{1}, Exception:{2}",
            arguments.CurrentRetryCount, arguments.Delay, arguments.LastException);

        Trace.WriteLine(msg, "Information");

        // Do some work that may result in a transient fault.
            () =>
    catch (Exception)

Randy Levy
Enterprise Library support engineer 

Jul 12, 2012 at 9:29 AM


I modified my program.

Now I have one method that performs an export of an Windows Azure SQL database using SQL Dac Import Export Service.

                                requestKey = ExportDatabase(targetDatabase, targetFile, this.backupFolder);
The method has to throw exception on error for the retry process to work, am I correct ?

Thanks for your help.