Azure 应用服务在 ARM 模板部署期间暂时不可用。即使我们使用应用程序暂存槽

标签 azure azure-devops azure-web-app-service azure-resource-manager

我们有一个 Azure DevOps 发布管道,并以 ARM 模板部署作为每个版本的开始。我们这样做是为了确保我们的 Azure 资源与存储库中配置的 ARM 模板保持同步。 我们观察到 azure 应用程序服务在 Arm 部署时返回 HTTP 503 然后我们引入应用程序槽并在其中添加所有应用程序设置,并从 azure 应用程序中删除应用程序设置。我们将应用程序暂存槽部署为单独的资源,然后与主槽交换,然后所有应用程序设置在槽之间交换 我们的期望是在 Arm 部署期间停止 Web 应用程序不可用的时间,但即使我们使用配置部署应用程序槽,主槽也会在一段时间内处于不可用状态。插槽之间的交换无需停机即可进行。 事情就是这样发生的吗?或者Arm​​出了什么问题? 这就是我们配置 ARM 的方式

{
     "apiVersion": "2016-08-01",
        "name": "xxnamexx",
        "type": "Microsoft.Web/sites",
        "location": "xxxlocationxxx",
        "copy": {
            "name": "webSiteDeployment",
            "count": "2"
        },
        "dependsOn": [
            "servicepalnxxx",
            "identityproviderxxx"
        ],
        "tags": {
            
            "displayName": "Website"
        },
        "identity": {
            "type": "UserAssigned",
            "userAssignedIdentities": {
            "": {}
            }
        },
        "properties": {
            "name": "namexxx",
            "webSocketsEnabled": true,
            "clientAffinityEnabled": false,
            "httpsOnly": true,
            "serverFarmId": "servicepalnxxx",
            "netFrameworkVersion": "v5.0",
            "siteConfig": {
                "http20Enabled": true,
                "minTlsVersion": "1.2"
            }
        }
},

插槽配置方式如下

    {
        "apiVersion": "2016-08-01",
        "type": "Microsoft.Web/sites/slots",
        "name": "namexxx",
        "kind": "app",
        "location": "xxxlocationxxx",
        "comments": "This specifies the web app slots.",
        "tags": {
            "displayName": "WebAppSlots"
        },
        "identity": {
            "type": "UserAssigned",
            "userAssignedIdentities": {
                "": {}
            }
        },
        "properties": {
            "serverFarmId": "serviceplan"
        },
        "dependsOn": [
            "webapp"
        ],

        "resources": [
            {
            "name": "appsettings",
            "type": "config",
            "apiVersion": "2016-08-01",
            "dependsOn": [
                 "depend onslot"
                 ],
            "tags": {
                    "displayName": "appSetting"
                },     
            "properties": {
                "name": "value",
                "name": "value",
                "name": "value"
              }   
            }
        ],
        "copy": {
            "name": "webSiteDeployment",
            "count": "2"
        }
    }

最佳答案

我不会将 ARM 视为原因,而是专注于对您收到的 503 错误进行故障排除。

这些可能是由多种事件引起的,例如应用程序崩溃(代码中是否存在导致首次加载时崩溃的错误?)、应用程序挂起或其他问题。

首先,我建议启用应用程序日志,以便您不仅可以捕获 http 错误代码,还可以捕获 http 子状态代码。使用下面的子状态代码列表来查看发生了什么。或者,请回复此帖子并附上您的 503 错误子状态代码,以便我们提供进一步帮助。

 <httpsubStatus>
    <error id ="0" description="Server unavailable" />
    <error id ="2" description="Concurrent requests limit reached." />
    <error id ="3" description="ASP.NET queue full" />
    <error id ="4" description="FastCGI queue full" />
    <error id ="12" description="WebSocket request made for site with websocket disabled."     />
    <error id ="13" description="Number of active WebSocket requests has reached the maximum concurrent WebSocket requests allowed." />
    <!-- Request throttler events -->
    <error id ="28" description="Front End Request throttler queue full" />
    <error id ="29" description="Front End Request throttler (empty site)" />
    <error id ="30" description="Front End Request throttler (client disconnect)" />
    <error id ="31" description="Front End Request throttler hot site blocked" />
    <!-- Antares Rewrite provider codes-->
    <error id ="64" description="Exception in rewrite provider (probably SQL)" />
    <error id ="65" description="Servers unavailable" />
    <error id ="66" description="Generic Error" />
    <error id ="69" description="app service plan is Scaling" />
    <error id ="70" description="Site Routed To Incorrect Worker" />
    <error id ="71" description="Function Scale Out" />
    <!-- iisnode -->
    <error id ="1000" description="ERROR_NOT_ENOUGH_QUOTA: OnExecuteRequestHandler" />
    <error id ="1001" description="iisnode failed to accept a request because the application is recycling" />
    <error id ="1002" description="iisnode failed to initiate processing of a request" />
    <error id ="1003" description="iisnode was unable to establish named pipe connection to the node.exe process because the named pipe server is too busy" /> 

  

关于Azure 应用服务在 ARM 模板部署期间暂时不可用。即使我们使用应用程序暂存槽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68284465/

相关文章:

azure - 作为 Azure 门户中的全局管理员,我无法配置持续交付预览

java - 使用 Java 从 Azure API 获取 CPU 使用情况

c# - Azure 表随机返回 null 值

Azure API 管理直通到后端服务

asp.net-mvc - 托管 AngularJS 和图像的问题

azure - 自动更新从 github 存储库更改为 Azure DevOps

audio - DevOps构建管道概述和失败时的声音触发

azure-devops - 作业失败时 Azure Devops 管道完成并带有警告标志

azure - 如何以编程方式 (C#) 读取 Web 应用程序的自动缩放设置?

azure - 在 Azure 中部署和调度控制台应用程序