【问题标题】:Redeploying azure web app from scratch with ARM template result in 404 Web Site not found使用 ARM 模板从头开始重新部署 azure Web 应用程序导致 404 网站未找到
【发布时间】:2018-05-11 15:30:13
【问题描述】:

我正在使用 ARM 模板将我的 Azure 资源组部署为我的发布定义的一部分。对于我的开发环境,我在使用 ARM 模板重新部署之前删除了整个资源组。

在部署过程中,我通过获取 swagger 定义中包含的版本号来测试部署到暂存槽的 API。这意味着此时我的网络应用程序可以正常访问。为了完成部署,我将生产槽与暂存槽交换。

之后,当我尝试通过https://mywebapp.azurewebsite.net 访问我的网络应用程序时,Chrome 卡在带有404 Web Site not found 的蓝页上。该页面提出了 2 个解决方案:

  • 确保自定义域正常工作,但我在此网络应用中没有。
  • 从命令行刷新 DNS 缓存。我做到了,但在页面刷新后没有任何变化。

知道出了什么问题吗?

这显然与我删除整个资源组以重新创建它的事实有关。在我默认不删除资源组的 QA/Prod 环境中,我没有看到相同的行为。

另外,我在开发部署过程中注意到一些警告消息:

2018-05-11T14:12:07.6188142Z ##[debug][PUT]https://$mywebapp__maintenance:***@mywebapp-maintenance.scm.azurewebsites.net/api/deployments/5921526047927616
2018-05-11T14:12:12.8970287Z ##[debug]updateDeployment. Data: {"statusCode":403,"statusMessage":"Forbidden","headers":{"content-type":"text/html","server":"Microsoft-IIS/10.0","date":"Fri, 11 May 2018 14:12:12 GMT","connection":"close","content-length":"2399"},"body":"<!DOCTYPE html>\r\n<html>\r\n<head>\r\n    <title>Web App - Unavailable</title>\r\n    <style type=\"text/css\">\r\n        html {\r\n            height: 100%;\r\n            width: 100%;\r\n        }\r\n\r\n        #feature {\r\n            width: 960px;\r\n            margin: 95px auto 0 auto;\r\n            overflow: auto;\r\n        }\r\n\r\n        #content {\r\n            font-family: \"Segoe UI\";\r\n            font-weight: normal;\r\n            font-size: 22px;\r\n            color: #ffffff;\r\n            float: left;\r\n            width: 460px;\r\n            margin-top: 68px;\r\n            margin-left: 0px;\r\n            vertical-align: middle;\r\n        }\r\n\r\n            #content h1 {\r\n                font-family: \"Segoe UI Light\";\r\n                color: #ffffff;\r\n                font-weight: normal;\r\n                font-size: 60px;\r\n                line-height: 48pt;\r\n                width: 800px;\r\n            }\r\n\r\n        p a, p a:visited, p a:active, p a:hover {\r\n            color: #ffffff;\r\n        }\r\n\r\n        #content a.button {\r\n            background: #0DBCF2;\r\n            border: 1px solid #FFFFFF;\r\n            color: #FFFFFF;\r\n            display: inline-block;\r\n            font-family: Segoe UI;\r\n            font-size: 24px;\r\n            line-height: 46px;\r\n            margin-top: 10px;\r\n            padding: 0 15px 3px;\r\n            text-decoration: none;\r\n        }\r\n\r\n            #content a.button img {\r\n                float: right;\r\n                padding: 10px 0 0 15px;\r\n            }\r\n\r\n            #content a.button:hover {\r\n                background: #1C75BC;\r\n            }\r\n    </style>\r\n</head>\r\n<body bgcolor=\"#00abec\">\r\n    <div id=\"feature\">\r\n            <div id=\"content\">\r\n                <h1 id=\"unavailable\">Error 403 - This web app is stopped.</h1>\r\n                <p id=\"tryAgain\">The web app you have attempted to reach is currently stopped and does not accept any requests. Please try to reload the page or visit it again soon.</p>\r\n                <p id=\"toAdmin\">If you are the web app administrator, please find the common 403 error scenarios and resolution <a href=\"http://blogs.msdn.com/b/waws/archive/2016/01/05/azure-web-apps-error-403-this-web-app-is-stopped.aspx\" target=\"_blank\">here</a>. For further troubleshooting tools and recommendations, please visit <a href=\"https://portal.azure.com/\">Azure Portal</a>.</p>\r\n        </div>\r\n    </div>\r\n</body>\r\n</html>\r\n"}
2018-05-11T14:12:12.9060930Z ##[warning]Error: Failed to update Deployment status. Error: Forbidden (CODE: 403)
2018-05-11T14:12:12.9071339Z ##[debug]Processed: ##vso[task.issue type=warning;]Error: Failed to update Deployment status. Error: Forbidden (CODE: 403)
...
2018-05-11T14:21:03.6299150Z ##[debug][PUT]https://$mywebapp:***@mywebapp.scm.azurewebsites.net/api/deployments/5921526048459655
2018-05-11T14:21:03.8067460Z ##[debug]updateDeployment. Data: {"statusCode":404,"statusMessage":"Site Not Found","headers":{"content-type":"text/html","server":"Microsoft-IIS/10.0","date":"Fri, 11 May 2018 14:21:03 GMT","connection":"close","content-length":"2778"},"body":"<!DOCTYPE html>\r\n<html>\r\n<head>\r\n    <title>Microsoft Azure Web App - Error 404</title>\r\n    <style type=\"text/css\">\r\n        html {\r\n            height: 100%;\r\n            width: 100%;\r\n        }\r\n\r\n        #feature {\r\n            width: 960px;\r\n            margin: 75px auto 0 auto;\r\n            overflow: auto;\r\n        }\r\n\r\n        #content {\r\n            font-family: \"Segoe UI\";\r\n            font-weight: normal;\r\n            font-size: 22px;\r\n            color: #ffffff;\r\n            float: left;\r\n            margin-top: 68px;\r\n            margin-left: 0px;\r\n            vertical-align: middle;\r\n        }\r\n\r\n            #content h1 {\r\n                font-family: \"Segoe UI Light\";\r\n                color: #ffffff;\r\n                font-weight: normal;\r\n                font-size: 60px;\r\n                line-height: 48pt;\r\n                width: 800px;\r\n            }\r\n\r\n        a, a:visited, a:active, a:hover {\r\n            color: #ffffff;\r\n        }\r\n\r\n        #content a.button {\r\n            background: #0DBCF2;\r\n            border: 1px solid #FFFFFF;\r\n            color: #FFFFFF;\r\n            display: inline-block;\r\n            font-family: Segoe UI;\r\n            font-size: 24px;\r\n            line-height: 46px;\r\n            margin-top: 10px;\r\n            padding: 0 15px 3px;\r\n            text-decoration: none;\r\n        }\r\n\r\n            #content a.button img {\r\n                float: right;\r\n                padding: 10px 0 0 15px;\r\n            }\r\n\r\n            #content a.button:hover {\r\n                background: #1C75BC;\r\n            }\r\n    </style>\r\n    <script type=\"text/javascript\">\r\n        function toggle_visibility(id) {\r\n            var e = document.getElementById(id);\r\n            if (e.style.display == 'block')\r\n                e.style.display = 'none';\r\n            else\r\n                e.style.display = 'block';\r\n        }\r\n    </script>\r\n</head>\r\n<body bgcolor=\"#00abec\">\r\n    <div id=\"feature\">\r\n        <div id=\"content\">\r\n            <h1>404 Web Site not found.</h1>\r\n            <p>You may be seeing this error due to one of the reasons listed below :</p>\r\n            <ul>\r\n                <li>Custom domain has not been configured inside Azure. See <a href=\"https://docs.microsoft.com/en-us/azure/app-service-web/app-service-web-tutorial-custom-domain\">how to map an existing domain</a> to resolve this.</li>\r\n                <li>Client cache is still pointing the domain to old IP address. Clear the cache by running the command <i>ipconfig/flushdns.</i></li>\r\n            </ul>\r\n            <p>Checkout <a href=\"https://blogs.msdn.microsoft.com/appserviceteam/2017/08/08/faq-app-service-domain-preview-and-custom-domains/\">App Service Domain FAQ</a> for more questions.</p>\r\n        </div>\r\n     </div>\r\n</body>\r\n</html>\r\n"}
2018-05-11T14:21:03.8165740Z ##[warning]Error: Failed to update Deployment status. Error: Site Not Found (CODE: 404)
2018-05-11T14:21:03.8166510Z ##[debug]Processed: ##vso[task.issue type=warning;]Error: Failed to update Deployment status. Error: Site Not Found (CODE: 404)
...
2018-05-11T14:22:19.4199443Z ##[debug][PUT]https://$mywebapp__maintenance:***@mywebapp-maintenance.scm.azurewebsites.net/api/deployments/5921526048539418
2018-05-11T14:22:19.6243408Z ##[debug]updateDeployment. Data: {"statusCode":404,"statusMessage":"Site Not Found","headers":{"content-type":"text/html","server":"Microsoft-IIS/10.0","date":"Fri, 11 May 2018 14:22:19 GMT","connection":"close","content-length":"2778"},"body":"<!DOCTYPE html>\r\n<html>\r\n<head>\r\n    <title>Microsoft Azure Web App - Error 404</title>\r\n    <style type=\"text/css\">\r\n        html {\r\n            height: 100%;\r\n            width: 100%;\r\n        }\r\n\r\n        #feature {\r\n            width: 960px;\r\n            margin: 75px auto 0 auto;\r\n            overflow: auto;\r\n        }\r\n\r\n        #content {\r\n            font-family: \"Segoe UI\";\r\n            font-weight: normal;\r\n            font-size: 22px;\r\n            color: #ffffff;\r\n            float: left;\r\n            margin-top: 68px;\r\n            margin-left: 0px;\r\n            vertical-align: middle;\r\n        }\r\n\r\n            #content h1 {\r\n                font-family: \"Segoe UI Light\";\r\n                color: #ffffff;\r\n                font-weight: normal;\r\n                font-size: 60px;\r\n                line-height: 48pt;\r\n                width: 800px;\r\n            }\r\n\r\n        a, a:visited, a:active, a:hover {\r\n            color: #ffffff;\r\n        }\r\n\r\n        #content a.button {\r\n            background: #0DBCF2;\r\n            border: 1px solid #FFFFFF;\r\n            color: #FFFFFF;\r\n            display: inline-block;\r\n            font-family: Segoe UI;\r\n            font-size: 24px;\r\n            line-height: 46px;\r\n            margin-top: 10px;\r\n            padding: 0 15px 3px;\r\n            text-decoration: none;\r\n        }\r\n\r\n            #content a.button img {\r\n                float: right;\r\n                padding: 10px 0 0 15px;\r\n            }\r\n\r\n            #content a.button:hover {\r\n                background: #1C75BC;\r\n            }\r\n    </style>\r\n    <script type=\"text/javascript\">\r\n        function toggle_visibility(id) {\r\n            var e = document.getElementById(id);\r\n            if (e.style.display == 'block')\r\n                e.style.display = 'none';\r\n            else\r\n                e.style.display = 'block';\r\n        }\r\n    </script>\r\n</head>\r\n<body bgcolor=\"#00abec\">\r\n    <div id=\"feature\">\r\n        <div id=\"content\">\r\n            <h1>404 Web Site not found.</h1>\r\n            <p>You may be seeing this error due to one of the reasons listed below :</p>\r\n            <ul>\r\n                <li>Custom domain has not been configured inside Azure. See <a href=\"https://docs.microsoft.com/en-us/azure/app-service-web/app-service-web-tutorial-custom-domain\">how to map an existing domain</a> to resolve this.</li>\r\n                <li>Client cache is still pointing the domain to old IP address. Clear the cache by running the command <i>ipconfig/flushdns.</i></li>\r\n            </ul>\r\n            <p>Checkout <a href=\"https://blogs.msdn.microsoft.com/appserviceteam/2017/08/08/faq-app-service-domain-preview-and-custom-domains/\">App Service Domain FAQ</a> for more questions.</p>\r\n        </div>\r\n     </div>\r\n</body>\r\n</html>\r\n"}
2018-05-11T14:22:19.6268196Z ##[warning]Error: Failed to update Deployment status. Error: Site Not Found (CODE: 404)
2018-05-11T14:22:19.6268967Z ##[debug]Processed: ##vso[task.issue type=warning;]Error: Failed to update Deployment status. Error: Site Not Found (CODE: 404)

【问题讨论】:

    标签: azure azure-web-app-service azure-resource-manager arm-template


    【解决方案1】:

    该行为可能是由您计算机上的 DNS 缓存引起的。当您删除并重新创建应用程序时,它可能会在具有不同 IP 地址的不同规模单元上结束。但是由于您可能只是点击了具有相同主机名的旧应用程序,因此您的计算机已缓存其 IP。解决方法:

    • 等到 TTL 过期
    • 清除您的 DNS 缓存。可能会很棘手,因为某些代理中也可能存在缓存
    • 如果您在没有缓存的其他机器上尝试,它应该可以立即工作(例如,用您的手机尝试)

    【讨论】:

    • 实际上我确实使用ipconfig /flushdns 清除了缓存,但它并没有改变任何东西。 Chrome 仍然达到 404。我从 Edge 尝试过,也得到了 404。我终于在同一台机器上尝试了 Firefox,它确实可以工作,而其他人没有。在那之后,我启动了 Wireshark 并注意到 Firefox 是唯一在几乎每次刷新时都能解析 DNS 而 Chrome 和 Edge 没有。这是否意味着这里没有真正的解决方法,除了不要在发布定义中删除/重新创建支持环境的资源组?
    猜你喜欢
    • 2020-08-23
    • 2021-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-25
    • 2019-07-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多