Storing Autoscaling Application Block Configuration in Blob Storage

Retired Content

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

Typically, the configuration settings for the Autoscaling Application Block are stored in the app.config or web.config file of the role that hosts the block. You can also configure the role to load the Autoscaling Application Block configuration settings from Microsoft Azure blob storage. To do this you must perform the following steps.

  1. Add the NuGet package that provides support for this scenario to your Visual Studio solution.
  2. Modify the role's configuration file to point to a file in blob storage that contains the Autoscaling Application Block configuration settings.
  3. Create the standalone configuration file that contains the block's configuration settings, and upload that file to blob storage.
  4. Modify your Azure application so that it can read the contents of the configuration file in blob storage.
Hh680890.note(en-us,PandP.50).gifNote:
If you need to make changes to the configuration in blob storage, you should edit a local copy of the configuration file and then upload it to replace the existing copy in blob storage. For more information about how the Autoscaling Application Block handles configuration changes at run time, see "Configuration Changes at Run Time."

You can use the same technique to store other block configurations in blob storage.

Adding the Configuration NuGet Package to Your Visual Studio Solution

You must add support for storing configuration settings in blob storage to your Visual Studio solution. To do this, you can use the NuGet package manager.

To prepare your application

  1. Add a reference to the Autoscaling Application Block Configuration assembly. In Microsoft Visual Studio, right-click your project node in Solution Explorer, and then click Manage NuGet Packages.
  2. Click the Online button, and then in the Search Online box, type Windows Azure Configuration Extensions.
  3. Click the Install button for the Enterprise Library 5.0 – Enterprise Library 5.0 - Windows Azure Configuration Extensions package.
  4. Read and accept the license terms for the packages listed.
  5. After NuGet has finished installing the packages, click Close.

Modifying the Role's Configuration File

You must update the role's configuration file to reference the Autoscaling Application Block configuration settings file in Azure blob storage.

To modify the role configuration file

  1. Right-click on the app.config file in the project that will be hosting the block and click Edit configuration file.
  2. Delete any blocks that you do not plan to use.
  3. In the Enterprise Library Configuration tool, open the Blocks menu, and then click Add Configuration Settings.
  4. You can delete the System Configuration Source.
  5. Click the plus sign next to Sources, point to Add Sources, and then click Add Blob Configuration Source.

    Hh680890.F386D6F89DB55C6D5892649DA8EE8192(en-us,PandP.50).png

  6. Configure the Blob Configuration Source with the details of the blob where you will store the Autoscaling Application Block configuration settings.
  7. Expand the Configuration Sources section, and in the Selected Source drop-down, select the name of your blob configuration source.

    Hh680890.6163CF971D2A5783170404781CC980D8(en-us,PandP.50).png

  8. On the File menu, click Save. Then on the File menu, click Exit.

Creating the Standalone Autoscaling Application Block Configuration File

You must create a configuration file that contains the Autoscaling Application Block configuration settings and then upload it to the blob container that you configured in the previous procedure.

To prepare the standalone Autoscaling Application Block configuration file

  1. Right-click on the app.config file in the project that will be hosting the block and click Edit configuration file.
  2. On the File menu, click New. Then on the Blocks menu, click Add Autoscaling Settings.
  3. Configure the autoscaling settings for your application. For more information, see the topic "Entering Configuration Information."

    Hh680890.CE3C852372B9AB40A15538A49F925E8B(en-us,PandP.50).png

  4. On the File menu, click Save. Chose a folder in which to save the configuration file, and name it EntLib.config to match the configuration settings in the previous procedure.
    Hh680890.note(en-us,PandP.50).gifNote:
    This file does not need to be part of your Visual Studio project. You can edit it at any time using the Enterprise Library configuration tool.

  5. Upload the configuration file to the blob container you specified in the previous procedure; for example, as a blob named EntLib.config in a container named entlib-container, in your Azure storage account. Use a tool of your choice to upload the file. For a selection of tools, see "Azure Tools."
    Hh680890.note(en-us,PandP.50).gifNote:
    If you edit the configuration file, you will need to upload it again to the blob container.

Modifying Your Azure Application

This configuration scenario relies on writing to a temp folder. You must modify your Azure application to include a temporary folder location.

Adding support for a temp folder to your Azure application

  1. Configure a local storage resource for the role that is hosting the Autoscaling Application Block. For more information, see "How to Configure Local Storage Resources" on MSDN.
  2. Add the following code to the OnStart method of the role that hosts the Autoscaling Application Block.
    var tempPath = RoleEnvironment.GetLocalResource("Temp").RootPath;
    Environment.SetEnvironmentVariable("TEMP", tempPath);
    Environment.SetEnvironmentVariable("TMP", tempPath);
    

Last built: June 7, 2012

Show: