您还可以使用以下信息:
http ://blog.maartenballiauw.be/post/2011/03/21/Windows-Azure-and-scaling-how-(NET).aspx
主要是:
var deployment = GetWindowsAzureDeployment();
string configurationXml = ServiceManagementHelper.DecodeFromBase64String(deployment.Configuration);
Log.Info("Updating configuration value...");
var serviceConfiguration = XDocument.Parse(configurationXml);
serviceConfiguration
.Descendants()
.Single(d => d.Name.LocalName == "Role" && d.Attributes().Single(a => a.Name.LocalName == "name").Value == RoleName)
.Elements()
.Single(e => e.Name.LocalName == "Instances")
.Attributes()
.Single(a => a.Name.LocalName == "count").Value = newInstanceCount.ToString();
var changeConfigurationInput = new ChangeConfigurationInput();
changeConfigurationInput.Configuration = ServiceManagementHelper.EncodeToBase64String(serviceConfiguration.ToString(SaveOptions.DisableFormatting));
Log.Info("Uploading new configuration...");
ManagementClient.ChangeConfigurationBySlot(SubscriptionId, ServiceName, Slot, changeConfigurationInput);
Log.Info("Finished uploading new configuration.");