Azure应用程序服务部署文件正在使用中

Azure应用程序服务部署文件正在使用中,azure,azure-pipelines-release-pipeline,Azure,Azure Pipelines Release Pipeline,在我的项目中,我们使用Azure应用程序服务部署任务来部署我们的webdeploy包 我注意到,有时在部署时会出现文件使用错误,即使启用了“使应用离线”选项 解决这个问题的最佳方法是什么 这就是错误: 2016-12-07T15:26:44.8411101Z ##[error]Failed to deploy website. 2016-12-07T15:26:44.8411101Z ##[error]Error Code: ERROR_FILE_IN_USE 2016-12-07T15:2

在我的项目中,我们使用Azure应用程序服务部署任务来部署我们的webdeploy包

我注意到,有时在部署时会出现文件使用错误,即使启用了“使应用离线”选项

解决这个问题的最佳方法是什么

这就是错误:

2016-12-07T15:26:44.8411101Z ##[error]Failed to deploy website.

2016-12-07T15:26:44.8411101Z ##[error]Error Code: ERROR_FILE_IN_USE

2016-12-07T15:26:44.8421096Z More Information: Web Deploy cannot modify the file 'Microsoft.CodeAnalysis.CSharp.dll' on the destination because it is locked by an external process.  In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.

我有一个临时修复程序,这是本页中推荐的

在部署之前,我已使用此命令执行Azure CLI任务:

azure webapp stop --resource-group XX --name YY
azure webapp start --resource-group XX --name YY
(其中XX是资源组名称,YY是web应用服务)

然后使用Azure Web部署任务执行部署

然后在部署后执行此Azure CLI任务:

azure webapp stop --resource-group XX --name YY
azure webapp start --resource-group XX --name YY
这是可行的。

您现在可以使用“任务”来停止和启动应用程序服务,以防止文件被使用