当我尝试在 Azure Devops 中使用发布管道进行部署时,我遇到了锁定 DLL 文件的问题。
错误截图如下:
输出为文本:
2021-03-31T17:43:18.2626492Z ##[error]Error Code: ERROR_FILE_IN_USE
More Information: Web Deploy cannot modify the file 'Microsoft.Data.SqlClient.SNI.x64.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.
Error count: 1.
看来问题是由错误处理的 .NET 资源引起的。(例如:非托管 SqlConnection) 无论如何,我无法更改源代码。
这是我的发布管道。
以下是我的问题:
Q1)我正在尝试使用此处描述的“-RenameFilesFlag”(MSDEPLOY_RENAME_LOCKED_FILES):
在 Azure 应用服务部署任务期间锁定的 web.config 文件
我该如何指定这个参数?我是否必须填写“附加参数”文本框?我尝试了不同的值,但总是收到“无法识别的参数”错误。
Q2) 如果“-RenameFilesFlag”不适用于此任务。我可以使用“使应用程序脱机”来解锁文件吗?
Q3)在 StackOverflow 上的另一篇文章中,我看到了一个特定于“重命名锁定文件”的复选框选项, 在 Azure App Service Task v3 中使用 Web 部署时出现了 ERROR_FILE_IN_USE
我的任务中没有这个选项。我是否有可能混淆了两种类型的 Deploy 任务?