问题描述
现在,即使通过KUDU进行的zip部署成功返回后,我仍然再次遇到一个问题,即在Azure Function应用程序上使用了旧代码.
Right now I again faced the issue that old code is used on an Azure Function App even after the zip deployment through KUDU returns success.
当然,那是在30分钟之后,我希望新代码能够立即加载,而不是立即加载.
Of course, that is after some 30 mins that I expect the new code to get loaded, not immediately.
问题被标记为已关闭.
在这种情况下,最佳做法是:
What is considered to be the best practice in this case:
- 通过编程方式强制Function App通过Azure CLI或Powershell Az模块重新启动?
- 还是有另一种缓解问题的方法?
推荐答案
虽然重新启动应解决此问题,但我的建议是启用从程序包运行": https://docs.microsoft.com/zh-cn/azure/azure/azure-functions/run-functions-from-deployment-package .由于部署是原子的,因此消除了运行旧文件的机会.
While restarting should fix it, my suggestion would be to enable "Run from package": https://docs.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package. That removes the chance of having old files running as the deployment is atomic.
您需要将 WEBSITE_RUN_FROM_PACKAGE
的应用设置设置为 1
,并继续按照今天的方式进行部署.该站点将直接从该程序包运行(wwwroot在kudu中将显示为只读),因此不会进行解压缩和复制,这可能会导致您遇到问题.
You'd set an app setting of WEBSITE_RUN_FROM_PACKAGE
to 1
and continue deploying the same way you are today. The site will be run directly from that package (wwwroot will appear as read-only in kudu) so there's no unzipping and copying, which may be causing the issue you're having.
注意:看来我们仍然在这里跟踪问题: https://github.com/Azure/azure-functions-host/issues/2636 .
Note: it looks like we're still tracking the issue here: https://github.com/Azure/azure-functions-host/issues/2636.
这篇关于Azure功能:部署后旧代码仍在运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!