Azure Devops发布管道未能将web包部署到应用程序服务。Ip 403

Azure Devops发布管道未能将web包部署到应用程序服务。Ip 403,azure,azure-devops,azure-pipelines-release-pipeline,Azure,Azure Devops,Azure Pipelines Release Pipeline,我的发布管道在正常工作了几个月后,今天开始失败。。我找不到有关此错误的任何信息。以下是设置System.Debug=true后的相关日志 2019-06-03T09:12:56.1141807Z Package deployment using ZIP Deploy initiated. 2019-06-03T09:12:56.1227504Z ##[debug][POST]https://$DuoCore__staging:***@xxx-staging.scm.azurewebsites.n

我的发布管道在正常工作了几个月后,今天开始失败。。我找不到有关此错误的任何信息。以下是设置System.Debug=true后的相关日志

2019-06-03T09:12:56.1141807Z Package deployment using ZIP Deploy initiated.
2019-06-03T09:12:56.1227504Z ##[debug][POST]https://$DuoCore__staging:***@xxx-staging.scm.azurewebsites.net/api/zipdeploy?deployer=VSTS&message=%7B%22type%22%3A%22deployment%22%2C%22commitId%22%3A%2241ea351fc04ac594f9a979d19117e494e03c30aa%22%2C%22buildId%22%3A%223477%22%2C%22releaseId%22%3A%221780%22%2C%22buildNumber%22%3A%2220190602.1%22%2C%22releaseName%22%3A%22Release-37%22%2C%22repoProvider%22%3A%22TfsGit%22%2C%22repoName%22%3A%22xxxFront%22%2C%22collectionUrl%22%3A%22https%3A%2F%2Fvectorcuatrogroup.visualstudio.com%2F%22%2C%22teamProject%22%3A%223a39c617-c412-480d-aa54-be5cca265a43%22%2C%22slotName%22%3A%22Staging%22%7D
2019-06-03T09:12:56.2135188Z ##[debug]Could not parse response: {}
2019-06-03T09:12:56.2135454Z ##[debug]Response: undefined
2019-06-03T09:12:56.2137686Z ##[debug]ZIP Deploy response: {"statusCode":403,"statusMessage":"Ip Forbidden","headers":{"content-type":"text/html","server":"Microsoft-IIS/10.0","date":"Mon, 03 Jun 2019 09:12:55 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"}
2019-06-03T09:12:56.2199524Z ##[error]Failed to deploy web package to App Service.
2019-06-03T09:12:56.2208644Z ##[debug]Processed: ##vso[task.issue type=error;]Failed to deploy web package to App Service.
2019-06-03T09:12:56.2208989Z ##[debug]Deployment Failed with Error: Error: Error: Failed to deploy web package to App Service. Ip Forbidden (CODE: 403)
2019-06-03T09:12:56.2209141Z ##[debug]task result: Failed
2019-06-03T09:12:56.2209425Z ##[error]Error: Error: Failed to deploy web package to App Service. Ip Forbidden (CODE: 403)
2019-06-03T09:12:56.2209663Z ##[debug]Processed: ##vso[task.issue type=error;]Error: Error: Failed to deploy web package to App Service. Ip Forbidden (CODE: 403)
2019-06-03T09:12:56.2210196Z ##[debug]Processed: ##vso[task.complete result=Failed;]Error: Error: Failed to deploy web package to App Service. Ip Forbidden (CODE: 403)
2019-06-03T09:12:56.2210358Z ##[debug]Application Insights is not configured for the App Service. Skipping adding release annotation.
2019-06-03T09:12:56.2210529Z ##[debug][POST]https://management.azure.com/subscriptions/7b86f649-7ce5-4da3-ac60-3ad477c0dd15/resourceGroups/RG_DUO_WEBAPP_PRE/providers/Microsoft.Web/sites/DuoCore/slots/Staging/publishxml?api-version=2016-08-01
2019-06-03T09:12:56.7236671Z ##[debug]Could not parse response: {}
2019-06-03T09:12:56.7237203Z ##[debug]Response: undefined
2019-06-03T09:12:56.7380358Z App Service Application URL: http://duocore-staging.azurewebsites.net
2019-06-03T09:12:56.7381542Z ##[debug]set AppServiceApplicationUrl=http://duocore-staging.azurewebsites.net
2019-06-03T09:12:56.7382651Z ##[debug]Processed: ##vso[task.setvariable variable=AppServiceApplicationUrl;issecret=false;]http://duocore-staging.azurewebsites.net
2019-06-03T09:12:56.7383220Z ##[debug]Deployment failed
2019-06-03T09:12:56.7608716Z ##[section]Finishing: Deploy Azure App Service to Slot
2019-06-03T09:12:56.1141807Z包部署已启动使用ZIP部署。
2019-06-03T09:12:56.1227504Z[调试][发布]https://$DuoCore_uustaging:**@xxx staging.scm.azurewebsites.net/api/zipdeploy?deployer=VSTS&message=%7B%22type%22%3A%22deployment%22%2C%22commitId%22%3A%2241ea351fc04ac594f9a979d19117e494e03c30aa%22%2C%22buildId%22%223477%22%2C%22releaseId%22%3A%221780%22%2C%22buildNumber%22%3A%22190602%22%1%22%22%22%22%22%22%22%22%22%22%22%22%22%22%22%22%22%22%22%22%22%22%22%22%22%22视频%22%3A%22TfsGit%22%2C%22repoName%22%3A%22xxxFront%22%2C%22collectionUrl%22%3A%22https%3A%2F%2Fvectorcuatrogroup.visualstudio.com%2F%22%2C%22teamProject%22%3A%223a39c617-c412-480d-aa54-be5cca265a43%22%2C%22slotName%22%3A%22d
2019-06-03T09:12:56.2135188Z##[debug]无法分析响应:{}
2019-06-03T09:12:56.2135454Z###[调试]响应:未定义
2019-06-03T09:12:56.2137686Z###[调试]ZIP部署响应:{“状态码”:403,“状态消息”:“Ip禁止”,“标题”:“{”内容类型”:“文本/html”,“服务器”:“Microsoft IIS/10.0”,“日期”:“2019年6月3日星期一09:12:55 GMT”,“连接”:“关闭”,“内容长度”:“2399”,“正文”:“\r\n\r\n\r\n Web App-不可用\r\n\r\n html{\r\n高度:100%;\r\n宽度:100%;\r\n}\r\n\r\n特征{\r\n宽度:960px;\r\n边距:95px自动0自动;\r\n溢出:自动;\r\n}\r\n\r\n\r\n内容{\r\n字体系列:\“Segoe UI”\“;\r\n字体重量:正常;\r\n字体大小:22px;\r\n颜色:#ffffff;\r\n浮点:左;\r\n宽度:460px;\r\n页边空白顶部:68px;\r\n页边空白左侧:0px;\r\n垂直对齐:中间;\r\n}\r\n\r\n\r\n\r\n内容h1{\r\n字体系列:\“Segoe UI Light\”;\r\n颜色:#ffffff;\r\n字体重量:正常;\r\n字体大小:60px;\r\n线条高度:48pt;\r\n宽度:800px;\r\n}\r\n\r\n PA,PA:已访问,PA:活动,PA:悬停{\r\n颜色:#ffffffff;\r\n}\r\n\r\n#内容a按钮{\r\n背景:#0DBCF2;\r\n边框:1px实心#FFFFFF;\r\n颜色:#FFFFFF;\r\n显示:内联块;\r\n字体系列:Segoe UI;\r\n字体大小:24px;\r\n线条高度:46px;\r\n边框顶部:10px;\r\n填充:0 15px 3px;\r\n文本装饰离子:无;\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:悬停{\r\n背景:#1C75BC;\r\n}\r\n\r\n\r\n\r\n\r\n错误403-此web应用已停止。\r\n您尝试访问的web应用当前已停止,不接受任何请求。请尝试重新加载该页面或很快再次访问它。

\r\n\“>如果您是web应用程序管理员,请查找常见的403错误场景和解决方案。有关进一步的疑难解答工具和建议,请访问。

\r\n\r\n\r\n\r\n\r\n”} 2019-06-03T09:12:56.2199524Z###[错误]未能将web包部署到应用程序服务。 2019-06-03T09:12:56.2208644Z###[调试]已处理:##vso[task.issue type=error;]未能将web包部署到应用程序服务。 2019-06-03T09:12:56.2208989Z###[调试]部署失败,错误:错误:无法将web包部署到应用程序服务。Ip禁止(代码:403) 2019-06-03T09:12:56.2209141Z##[debug]任务结果:失败 2019-06-03T09:12:56.2209425Z###[错误]错误:错误:无法将web包部署到应用程序服务。Ip禁止(代码:403) 2019-06-03T09:12:56.2209663Z###[调试]已处理:##vso[task.issue type=error;]错误:错误:未能将web包部署到应用程序服务。Ip禁止(代码:403) 2019-06-03T09:12:56.2210196Z###[调试]已处理:##vso[task.complete result=Failed;]错误:错误:未能将web包部署到应用程序服务。Ip禁止(代码:403) 2019-06-03T09:12:56.2210358Z###[调试]未为应用程序服务配置应用程序洞察。正在跳过添加版本批注。 2019-06-03T09:12:56.2210529Z[调试][发布]https://management.azure.com/subscriptions/7b86f649-7ce5-4da3-ac60-3ad477c0dd15/resourceGroups/RG_DUO_WEBAPP_PRE/providers/Microsoft.Web/sites/DuoCore/slots/Staging/publishxml?api-版本=2016-08-01 2019-06-03T09:12:56.7236671Z##[debug]无法分析响应:{} 2019-06-03T09:12:56.7237203Z###[调试]响应:未定义 2019-06-03T09:12:56.7380358Z应用服务应用程序URL:http://duocore-staging.azurewebsites.net 2019-06-03T09:12:56.7381542Z###[调试]设置AppServiceApplicationUrl=http://duocore-staging.azurewebsites.net 2019-06-03T09:12:56.7382651Z##[debug]已处理:###vso[task.setvariable=AppServiceApplicationUrl;issecret=false;]http://duocore-staging.azurewebsites.net 2019-06-03T09:12:56.7383220Z###[调试]部署失败 2019-06-03T09:12:56.7608716Z###[部分]完成:将Azure应用程序服务部署到插槽
我已经从Devops验证了我的连接,没问题


解决方案:确保.scm.azurewebsites.net上没有IP限制

也有同样的错误,最后找到了原因。 我在功能应用程序上配置了防火墙,只允许几个IP通过,并且错误地勾选了框,使.SCM.azurewebsite.net也使用相同的设置


如果您有严格的防火墙规则,则可以在部署期间停用这些规则。我通过以下方式在CI管道中执行此操作:

az webapp config access-restriction set -g ResourceGroup -n AppName --use-same-restrictions-for-scm-site false
部署后:

az webapp config access-restriction set -g ResourceGroup -n AppName --use-same-restrictions-for-scm-site true
你当然可以