Change the Configuration of a Running Cloud Service
Updated: May 9, 2014
You might need to test the scalability of your cloud service by adding more running instances of a role. You do not need to stop a running service to add new role instances. To do this, you modify the configuration file (ServiceConfiguration.cscfg) for the cloud service, and then you update the running service by using the CSRun Command-Line Tool.
The following example shows the contents of a configuration file that defines the configuration for two worker roles that start with one running instance each:
<?xml version="1.0"?> <ServiceConfiguration serviceName="TestService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration"> <Role name="WorkerRole1"> <Instances count="1" /> <ConfigurationSettings> <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" /> </ConfigurationSettings> </Role> <Role name="WorkerRole2"> <Instances count="1" /> <ConfigurationSettings> <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" /> </ConfigurationSettings> </Role> </ServiceConfiguration>
Open the .cscfg file for your service (by default the name is ServiceConfiguration.cscfg) either by using Visual Studio or your preferred text editor.
Change the count value of the Instance element for a role to the desired amount. Change the value of the count attribute of the Instances element. The following example shows the configuration of two instances:
<Instances count="2" />
Make this change for each role that you want to increase running instances.
Save the configuration file.
Click Start, point to All Programs, and then click Windows Azure SDK.
Right-click Windows Azure SDK Command Prompt, and then click Run as administrator.
In the Azure SDK Command Prompt window, change the directory to where your hosted service files are located.
Type the following command in the command-prompt window:
Where <DeploymentID> is the identifier of the running deployment of your cloud service. You can find this identifier by locating the deployment node in the user interface of the Microsoft Azure compute emulator. <ServiceName> is the name of your cloud service.
The new role instances are suspended when created. To run the instances, click the deployment node, and then click the green arrow that runs role instances.