azurew website continuous deployment - Web Deploy cannot modify the file 'XXX' on the destination because it is locked by an external process

好久不见. 提交于 2019-11-29 09:18:45

You ran into a limitation of Azure and .NET

Recommended is restarting your application. This can be done by changing an environment variable which in turn forces iis to restart.

For example: In the azure dashboard:

Set COR_ENABLE_PROFILING = 0

then deploy and then again

 Set COR_ENABLE_PROFILING = 1

You can find a description of this problem here

I know this is an old topic. But i had this problem my selve and solved it in Azure.

Add MSDEPLOY_RENAME_LOCKED_FILES=1 to your settings in Azure.

If you want to automate stopping and starting the Azure App Service before and after the deployment, then if you are using VSTS, this task is now available out of the box (if you are using TFS, please find the tip with a market place task in one of the comments)

To leverage these tasks:

  1. In Release section of VSTS, add a Task to your Release Definition of type "Azure App Service Manage (PREVIEW) - Start, Stop, Restart or Slot swap for an Azure App Service"
  2. In the created task, select the action (for the first task, select "Stop App Service")
  3. Drag and drop this task before the deployment task and add a "Start App Service" task behind the deployment task
  4. In the task settings, you can also check, that this is applied only to a specific slot of the Azure App Service (e.g. "Stage")

After configuring those two additional tasks, it was working fine for me.

(... by the way, VSTS Build and CI now also supports ASP.NET CORE builds made with VS2017 by selecting Agent "HOST VS 2017")

If there is any automated option to do the below 3 steps, that should work.

  1. Stop app service
  2. Deploy code
  3. Start app service
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!