我正在尝试通过API将诊断扩展安装到现有的Azure云服务中。 Cloud Service已分配保留的IP。在使用ChangeConfigurationBySlot执行此操作时,我将“在部署更新或升级期间无法添加,删除或更改保留的IP 。”有谁知道让这个工作的诀窍?这是API中的错过还是我做错了什么?
以下是相关的代码段:
var dep = client.Deployments.GetBySlot(resource.ServiceName, DeploymentSlot.Production);
var serviceConfig = XElement.Parse(dep.Configuration, LoadOptions.SetBaseUri);
var config = new DeploymentChangeConfigurationParameters(serviceConfig.ToString())
{
ExtendedProperties = dep.ExtendedProperties,
Mode = DeploymentChangeConfigurationMode.Auto,
TreatWarningsAsError = false,
Configuration = serviceConfig.ToString(),
ExtensionConfiguration = new ExtensionConfiguration
{
AllRoles = new List<ExtensionConfiguration.Extension>(),
NamedRoles = extensionConfig
}
};
var result = client.Deployments.ChangeConfigurationBySlot(resource.ServiceName, DeploymentSlot.Production, config);
以下是云服务配置
的相关部分<ServiceConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" serviceName="IS.Admin.Azure" osFamily="4" osVersion="*" schemaVersion="2014-06.2.4" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
<Role name="IS.Admin">
…
</Role>
<NetworkConfiguration>
<VirtualNetworkSite name="is-prod" />
<AddressAssignments>
<InstanceAddress roleName="IS.Admin">
<Subnets>
<Subnet name="Subnet-1" />
</Subnets>
</InstanceAddress>
<ReservedIPs>
<ReservedIP name="is-admin-rip" />
</ReservedIPs>
</AddressAssignments>
</NetworkConfiguration>
</ServiceConfiguration>
我的更新与更改/删除/添加保留IP无关。有关如何更新服务配置的任何想法吗?
答案 0 :(得分:0)
尝试部署到暂存和进行vip交换。保留的ips对插槽是粘性的,所以它不应该干扰你的IP产品。