Поделиться через


Entering Configuration Information

Retired Content

This content and the technology described is outdated and is no longer being maintained. For more information, see Transient Fault Handling.

patterns & practices Developer Center

On this page:
Installing the Enterprise Library Configuration Console | Opening the Transient Fault Handling Application Block Configuration in the Enterprise Library Configuration Tool | Configuring Transient Fault Handling Settings | Editing Existing Retry Strategies | Adding a New Retry Strategy | Deleting a Retry Strategy

The Transient Fault Handling Application Block stores its configuration data in the main configuration file of the host worker role or on-premises application. To edit the configuration file you can either use the Enterprise Library Configuration Tool or edit the configuration file using a text editor. The configuration includes the following information:

  • Transient Fault Handling Settings. These settings define the default retry strategies for each service for which the block has a detection strategy.
  • Retry Strategies. These settings define all of the retry strategies that are stored in the configuration.

The following procedures explain how to configure these settings for the Transient Fault Handling Application Block.

For details of the schema for the Transient Fault Handling Application Block configuration, see Source Schema for the Transient Fault Handling Application Block. You can also configure the block in code by using an alternate configuration source. For more information, see Advanced Configuration Scenarios in the Enterprise Library 5.0 reference documentation.

These procedures assume you have added the Transient Fault Handling Application Block to your Visual Studio project from the NuGet repository as described in the topic "Adding the Transient Fault Handling Application Block to Your Solution."

Installing the Enterprise Library Configuration Console

To install the Enterprise Library Configuration Console if it is not already installed in Visual Studio:

  1. In Visual Studio, on the Tools menu, click Extension Manager.
  2. In the Extension Manager dialog, click Online Gallery, and then in the Search Online Gallery box, type Enterprise Library Config.
  3. Make sure that you can see version 5.0.505 of the EnterpriseLibrary.Config package. Then click the Download button.
  4. Read the license and then click Install.
  5. Click the Restart Now button to restart Visual Studio and complete the installation.

Opening the Transient Fault Handling Application Block Configuration in the Enterprise Library Configuration Tool

To open the Transient Fault Handling Application Block configuration in the Enterprise Library Configuration tool

  1. Right-click on the application .config file in the project that will be hosting the block and click Edit configuration file.
  2. In the Enterprise Library Configuration tool, open the Blocks menu, and then click Add Transient Fault Handling Settings.
  3. The Enterprise Library Configuration tool automatically adds the Transient Fault Handling Settings section with the default settings.

Configuring Transient Fault Handling Settings

To configure the transient fault handling settings

  1. Click the properties expander arrow in the Transient Fault Handling Settings section to open the list of properties.

    Hh680939.C62EE02B393043EF75A79770659BFD16(en-us,PandP.50).png

  2. (Optional) If you want to encrypt the configuration, make a selection from the Protection Provider drop-down list. You can select the RsaProtectedConfigurationProvider or the DataProtectionConfigurationProvider. See Encrypting Configuration Data for information about the restrictions on using the RsaProtectedConfigurationProvider.

  3. (Optional) If you want to run your application in partial trust mode, change the Require Permission property to False. The default is True.

    Note

    If the block is hosted in a Microsoft Azure role and it uses Azure diagnostic logging, then you must use full trust mode.

  4. (Optional) Use the drop-down list boxes to select the default retry strategies to use for each service. The drop-down list boxes show the retry strategies defined in the Retry Strategies section.

    Note

    There must be a Default Retry Strategy defined.

Editing Existing Retry Strategies

To edit an existing retry strategy

  1. To access the properties of an existing retry strategy, click the section expander to left of the retry strategy title.

  2. If the retry strategy is an incremental retry strategy, you can modify the properties shown in the following screenshot.

    Hh680939.B97D87E6734438907450E40AF005C835(en-us,PandP.50).png

  3. (Optional) You can change the name of the retry strategy.

  4. (Optional) You can select whether the block should perform the first retry immediately without waiting for the retry interval.

  5. (Optional) You can change the value of the increment used to change the interval for each retry.

  6. (Optional) You can modify the value of the initial interval between retries.

  7. (Optional) You can modify the maximum number of retries that the block will attempt.

  8. If the retry strategy is a fixed interval retry strategy, you can modify the properties shown in the following screenshot.

    Hh680939.FF2ECD75E703C373377864DA48212E89(en-us,PandP.50).png

  9. (Optional) You can change the name of the retry strategy.

  10. (Optional) You can select whether the block should perform the first retry immediately without waiting for the retry interval.

  11. (Optional) You can modify the value of the interval between retries.

  12. (Optional) You can modify the maximum number of retries that the block will attempt.

  13. If the retry strategy is an exponential back-off retry strategy, you can modify the properties shown in the following screenshot.

    Hh680939.B6488F112BE2B2346A8DA82236C41B32(en-us,PandP.50).png

  14. (Optional) You can change the name of the retry strategy.

  15. (Optional) You can modify the value of the initial delta between retries.

  16. (Optional) You can select whether the block should perform the first retry immediately without waiting for the retry interval.

  17. (Optional) You can modify the maximum number of retries that the block will attempt.

  18. (Optional) You can modify the maximum back-off delay.

  19. (Optional) You can modify the minimum back-off delay.

Note

To specify a timespan value in milliseconds, you can use this notation:
00:00:00.500 is 500 milliseconds.

Adding a New Retry Strategy

To add a new retry strategy

  1. To add a new retry strategy, click the plus sign icon at the top right of the Retry Strategies panel, select Add Retry Strategies, and then click on the type of retry strategy you would like to add.

    Hh680939.93E152FBBDC5D49101D53835DC2013DA(en-us,PandP.50).png

  2. Edit the new retry strategy following the instructions in the previous procedure "Editing Existing Retry Strategies."

    Hh680939.392132A4B7705387EF1E7B43CA7B3A91(en-us,PandP.50).png

  3. To add a custom retry strategy, browse to the assembly that contains your custom retry strategy. Your custom retry strategy must extend the abstract RetryStrategy class.

    Hh680939.A4D1EF5B17E00A1C63DFD5624ECE14A7(en-us,PandP.50).png

Deleting a Retry Strategy

To delete an existing retry strategy

  1. To delete a retry strategy, click the menu sign icon next at the bottom right of the panel that displays the retry strategy you want to delete, then click on the menu entry to delete the retry strategy.

    Hh680939.4E6F0B690A42BB99BC5D2262197DE802(en-us,PandP.50).png

  2. The retry strategy is removed from the list of retry strategies.

    Hh680939.4FC183AEE6102E5AB6F39FE75F3A4829(en-us,PandP.50).png

Next Topic | Previous Topic | Home

Last built: June 7, 2012