Microsoft.Web/sites/hostNameBindings 的 ARM 模板部署不断给我冲突错误

问题描述

我正在尝试部署应用服务,但我不断遇到部署失败 Microsoft.Web/sites/hostNameBindings

消息:无法修改站点,因为正在进行另一项操作。操作名称:RegisterTrafficManagerProfile,创建时间:5/14/2021 12:03:05 AM,,实体类型:1。 我间歇性地收到此错误

我阅读了堆栈溢出的答案之一,似乎流量管理器会导致异步 hostNameBindings 迭代操作出现问题。 这可以通过使用 "mode": "serial" 模式和 "batchsize": 1 指定同步副本来解决

我尝试了此解决方案,但仍然出现此冲突错误,不知道为什么?有人在同步副本后遇到同样的问题吗?

最近我们对模板进行了更改,将流量管理器端点部署为单独的资源,这导致流程需要更长的时间,流程时间的增加是否会导致冲突?导致此失败的其他原因是什么?

对此的任何见解都会有所帮助。我对开发应用服务臂模板很陌生

EDIT 我当前的 arm 模板我只是显示主机名绑定和流量管理器配置文件 {

classes

},

   <InputAdornment
-    position="start"
-    classes={{ positionStart: "0px" }}
+    position="end"
+    classes={ 
       positionEnd: {
         marginLeft: 0
       }
     }
    >

解决方法

我假设您想创建一个 Azure 流量管理器配置文件,其背后有一个应用服务。 Here 是供您参考的模板。这会在 Azure 应用服务的自定义域设置中自动预配自定义域 xxxx.trafficmanager.net

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#","contentVersion": "1.0.0.0","parameters": {
    "uniqueDnsName": {
      "type": "string","metadata": {
        "description": "Relative DNS name for the traffic manager profile,resulting FQDN will be <uniqueDnsName>.trafficmanager.net,must be globally unique."
      }
    },"uniqueDnsNameForWebApp": {
      "type": "string","metadata": {
        "description": "Relative DNS name for the WebApps,must be globally unique.  An index will be appended for each Web App."
      }
    },"webServerName": {
      "type": "string","metadata": {
        "description": "Name of the App Service Plan that is being created"
      }
    },"location": {
      "type": "string","defaultValue": "[resourceGroup().location]"
    },"trafficManagerName": {
      "type": "string","metadata": {
        "description": "Name of the trafficManager being created"
      }
    }
  },"variables": {},"resources": [
    {
      "type": "Microsoft.Web/serverfarms","apiVersion": "2019-08-01","name": "[parameters('webServerName')]","location": "[parameters('location')]","sku": {
        "name": "S1","tier": "Standard"
      }
    },{
      "type": "Microsoft.Web/sites","name": "[parameters('uniqueDnsNameForWebApp')]","dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms/',parameters('webServerName'))]"

      ],"properties": {
        "serverFarmId": "[parameters('webServerName')]"
      }
    },{
      "type": "Microsoft.Network/trafficManagerProfiles","apiVersion": "2018-08-01","name": "[parameters('trafficManagerName')]","location": "global","properties": {
        "profileStatus": "Enabled","trafficRoutingMethod": "Priority","dnsConfig": {
          "relativeName": "[parameters('uniqueDnsName')]","ttl": 30
        },"monitorConfig": {
          "protocol": "HTTPS","port": 443,"path": "/"
        }
      }
    },{
      "type": "Microsoft.Network/trafficManagerProfiles/azureEndpoints","name": "[concat(parameters('trafficManagerName'),'/',parameters('uniqueDnsNameForWebApp'))]","dependsOn": [
        "[resourceId('Microsoft.Network/trafficManagerProfiles/',parameters('trafficManagerName'))]","[resourceId('Microsoft.Web/sites/',parameters('uniqueDnsNameForWebApp'))]"
      ],"properties": {
        "targetResourceId": "[resourceId('Microsoft.Web/sites/',"endpointStatus": "Enabled"
      }
    }
  ]
}