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

Bar*_*VdA 1 yaml continuous-deployment azure-devops azure-pipelines-release-pipeline microsoft-data-sqlclient

实际的

部署时发布管道失败

预期的

部署不会失败

根本原因

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

解决方法

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

当使用“recycleAppPool”应用“Action IIS Application Pool”设置时,尝试自动回收也失败。

信息

错误信息

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.
Run Code Online (Sandbox Code Playgroud)

pem*_*mbr 5

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

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

[在此处部署应用程序]

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

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