问题
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.
Of course, that is after some 30 mins that I expect the new code to get loaded, not immediately.
The issue is marked as closed.
What is considered to be the best practice in this case:
- Programmatically force the Function App to restart, say, through Azure CLI or Powershell Az modules?
- Or there is another way to mitigate the issue?
回答1:
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.
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.
Note: it looks like we're still tracking the issue here: https://github.com/Azure/azure-functions-host/issues/2636.
来源:https://stackoverflow.com/questions/54555159/azure-function-old-code-still-running-after-a-deployment