【Azure 应用服务】Azure Function App在部署时候遇见 503 ServiceUnavailable

发布时间 2023-06-14 21:37:11作者: 路边两盏灯

问题描述

在VS Code中编写好 Azure Function App代码后,通过  func azure functionapp publish 部署失败,抛出 503 Service Unavailable 错误。

Getting site publishing info...
Creating archive for current directory...
Performing remote build for functions project.
Deleting the old .python_packages directory
Uploading 160.35 KB [##############################################################################] Error Uploading archive... (ServiceUnavailable).
Server Response:
<div style="display: block; margin: auto; width: 600px; height: 500px; text-align: center; font-family: 'Courier', cursive, sans-serif;">
<h1 style="color: 747474">:( Application Error</h1>
<p style="color:#666">If you are the application administrator, you can access the
<a style="color: grey"href="https://<yourfunctionappname>.scm.chinacloudsites.cn/detectors">diagnostic resources</a>.
</div>

 

问题解答

当通过 func azure functionapp publish 部署本地代码到Azure上的时候,使用的是zip部署,调用的是Kudu站点的  https://<yourfunctionappname>.scm.chinacloudsites.cn/api/zipdeploy 接口。 

当直接访问Function App的高级工具(kudu)站点时候,发现页面错误显示 Application Error。

 

这表示当前Azure Function的Kudu站点坏了,由于Kudu站点时默认创建的,当它不可用时,只有想办法重启/重建站点。

所以,解决方法为:

首先:重启Function App,如果重启不能让Kudu站点恢复正常,则进行下一步。

然后:缩放 或 升级 Function App的定价层,切换到一个新的实例(vm)来运行当前的Function服务。