Adding the Autoscaling Application Block to a Host
This content and the technology described is outdated and is no longer being maintained. For more information, see Transient Fault Handling.
The Autoscaling Application Block enables you to add autoscaling behavior to your Microsoft Azure application. When you work with the block in your application code, refer to the scenarios in the Key Scenarios sections and select those that best match your requirements.
Typically, you will host the block in its own Azure worker role. This worker role can be in a separate hosted service from the roles that the block will perform autoscaling operations on. You can also host the Autoscaling Application Block in an on-premises application. In both these scenarios, the block will monitor your Azure application and apply your autoscaling rules to it.
|You can also host the Autoscaling Application Block in the same worker role as the application.|
Before you can use the Autoscaling Application Block in your Visual Studio project, you will need to obtain the Autoscaling Application Block binaries and add references to them in your project. This topic describes how you can use the NuGet package management system to add everything you need to your project. For more information about NuGet, and how to use the NuGet Visual Studio extension, see the NuGet website.
To prepare your application
- Add a reference to the Autoscaling Application Block assembly. In Microsoft Visual Studio, right-click your project node in Solution Explorer, and then click Manage NuGet Packages.
- Click the Online button, and then in the Search Online box, type WASABi.
- Click the Install button for the Enterprise Library 5.0 – Azure Autoscaling Application Block package.
- Read and accept the license terms for the packages listed.
- After NuGet has finished installing the packages, click Close.
- NuGet has now updated your project with all the necessary assemblies and references that you need to use the Autoscaling Application Block. Your project now includes the XML schema files for the autoscaling rule definitions and autoscaling service information. The project now also includes a readme file that contains important information about the Autoscaling Application Block.
- (Optional) To use elements from the Autoscaling Application Block without fully qualifying the element reference, add the following using statements (C#) or Imports statements (Microsoft Visual Basic) to the top of your source code file.
|You can use the same procedure to configure both C# and Visual Basic projects to use the Autoscaling Application Block.|
Next, add the code to instantiate and run the block. Generally, there are three steps to create code that uses the Autoscaling Application Block:
- Resolve an Autoscaler instance. The Autoscaler class is the main entry point for the Autoscaling Application Block from your host application.
- Call the appropriate methods to start and stop the autoscaler.
- Create the configuration data for the autoscaler.
For more information about hosting the block in an Azure worker role, see the topic "Hosting the Autoscaling Application Block in a Worker Role."
For more information about hosting the block in an on-premises application, see the topic "Hosting the Autoscaling Application Block in an On-Premises Application."
For more information about configuring the block, see the topic "Entering Configuration Information."
Last built: June 7, 2012