0

实际的

部署时发布管道失败

预期的

部署不会失败

根本原因

文件“Microsoft.Data.SqlClient.SNI.x86.dll”被外部进程锁定,即使“使应用程序脱机标志”设置处于打开状态

解决方法

手动回收应用程序池并重新运行失败的部署。

使用“recycleAppPool”应用“Action IIS 应用程序池”设置时,尝试自动化回收也失败了。

信息

错误信息

Error Code: ERROR_FILE_IN_USE More Information: Web Deploy cannot modify the file 'Microsoft.Data.SqlClient.SNI.x86.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: The process cannot access the file because it is being used by another process.
4

2 回答 2

1

对于尚未使用 Azure 应用服务的用户。

      - task: IISWebAppManagementOnMachineGroup@0
        displayName: Stop AppPool
        inputs:
          IISDeploymentType: 'IISApplicationPool'
          ActionIISApplicationPool: 'StopAppPool'
          StartStopRecycleAppPoolName: '$(AppPoolName)'  

[在此处部署应用程序]

      - task: IISWebAppManagementOnMachineGroup@0
        displayName: Start AppPool
        inputs:
          IISDeploymentType: 'IISApplicationPool'
          ActionIISApplicationPool: 'StartAppPool'
          StartStopRecycleAppPoolName: '$(AppPoolName)'

更多信息: https ://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/iis-web-app-management-on-machine-group?view=azure-devops

于 2021-09-24T14:47:47.347 回答
0

Azure 发布管道 (YAML) IIS Web 部署在锁定文件上失败,生成 ERROR_FILE_IN_USE

您可以添加两个任务,部署前停止应用服务任务和部署后启动应用服务任务:

在此处输入图像描述

- task: AzureAppServiceManage@0
  displayName: 'Stop Azure App Service: tomsun'
  inputs:
    azureSubscription: 'xxxx'
    Action: 'Stop Azure App Service'
    WebAppName: xxxx


- task: AzureAppServiceManage@0
  displayName: 'Stop Azure App Service: tomsun'
  inputs:
    azureSubscription: 'xxxx'
    Action: 'Restart Azure App Service'
    WebAppName: xxxx

您也可以尝试在发布配置文件 ( .pubxml) 中配置 appOffline 规则。EnableMSDeployAppOffline像这样将元素添加到 PropertyGroup:

<PropertyGroup>
  <EnableMSDeployAppOffline>true</EnableMSDeployAppOffline>
</PropertyGroup>

请检查此文档ERROR_FILE_IN_USE此线程以获取更多详细信息。

于 2021-09-20T09:28:22.270 回答