Add option to stop website before deploying

At the moment I am having some issues deploying an Azure Web App (asp.net core). I always get the error that some files are locked by a process. Then I have to go to the Azure portal, stop the website (with the right slot) and retry.

Now I have solved this by adding this powershell script before the actual deployment:

Stop-AzureRmWebAppSlot -ResourceGroup "#{AzureResourceGroupName}" -Name "#{AzureWebsiteName}" -Slot "#{DeploymentSlot}"

Could something like this be added as an option to the “Deploy Azure Web App”, this step is aware of the slot, resource group and website name anyway.

Thanks!

Hi Geert,

Thanks for getting in touch.

We think this is a good idea. We’ve noticed that even if you restart your web-app (right before you deploy to it), Azure may still have files locked causing your deployment to fail, so the only sure way is what you’ve been doing: Stop -> Deploy -> Start.

We’ve added an internal card to investigate this as a feature on the Azure Web App step.

Cheers
Mark

Hi again Geert,

Another option that may be worth trying is the “Enable AppOffline” flag on the Azure Web App step. This flags gets sent through to WebDeploy as one of the deployment sync options, and is supposed to safely bring down the app domain before your deployment occurs. So this may also solve the problem of deploying to locked files during deployment.

Let me know how you go.

Cheers
Mark

1 Like

Any update on this? Locked files cause me to add an additional Stop step before deployment.