question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IIS Deploy on premises fails with ERROR_FILE_IN_USE

See original GitHub issue

Required Information

Question, Bug, or Feature?
Type: Bug

Enter Task Name: IISWebAppDeploymentOnMachineGroup

Environment

  • Server - Azure Pipelines
  • Agent - Hosted

Issue Description

I’m using the IISWebAppDeploymentOnMachineGroup@0 task to deploy a .NET Core 3.1 app to IIS on premises. The task fails sometimes with a ERROR_FILE_IN_USE code. I have set the TakeAppOfflineFlag to true but nothing changed.

Task logs

tasklogs.zip

Troubleshooting

Error logs

Info: Updating file (AGIL\Crpdl.Agil.Web.dll).
##[debug]Exit code 4294967295 received from tool 'C:\azagent\A1\_work\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba\0.156.13\node_modules\webdeployment-common-v2\MSDeploy3.6\msdeploy.exe'
##[debug]Exit code 4294967295 received from tool 'C:\azagent\A1\_work\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba\0.156.13\node_modules\webdeployment-common-v2\MSDeploy3.6\msdeploy.exe'
##[debug]STDIO streams have closed for tool 'C:\azagent\A1\_work\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba\0.156.13\node_modules\webdeployment-common-v2\MSDeploy3.6\msdeploy.exe'
##[debug]STDIO streams have closed for tool 'C:\azagent\A1\_work\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba\0.156.13\node_modules\webdeployment-common-v2\MSDeploy3.6\msdeploy.exe'
##[error]Failed to deploy web package to IIS website.
##[debug]Processed: ##vso[task.issue type=error;]Failed to deploy web package to IIS website.
##[debug]{}
##[debug]System.DefaultWorkingDirectory=C:\azagent\A1\_work\1\s
##[warning]Can\'t find loc string for key: Trytodeploywebappagainwithrenamefileoptionselected
##[debug]Processed: ##vso[task.issue type=warning;]Can\'t find loc string for key: Trytodeploywebappagainwithrenamefileoptionselected
##[warning]Trytodeploywebappagainwithrenamefileoptionselected
##[debug]Processed: ##vso[task.issue type=warning;]Trytodeploywebappagainwithrenamefileoptionselected
##[error]Error Code: ERROR_FILE_IN_USE
More Information: Web Deploy cannot modify the file 'Crpdl.Agil.Web.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.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:35 (8 by maintainers)

github_iconTop GitHub Comments

7reactions
guinatalcommented, Feb 24, 2021

Same problem here. .NET 5 web api running on premise. It looks like this is not something new by researching it… still didn’t find a solution though.

6reactions
mpoironcommented, Nov 26, 2020

Can we have an update on this issue ? I am still having this issue and having to kill the app pool each time is quite annoying.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Devops : How to enable the Rename locked files ...
This option is used to set the Azure App settings(cloud). It does not apply to IIS deployment(on-prem). ##[error]Error Code: ERROR_FILE_IN_USE.
Read more >
Errors occur when you use Web Deploy - Microsoft Learn
This article provides resolutions for the unexpected error that occurs when you perform Web Deploy operations remotely through IIS Manager ...
Read more >
Automating deployments to on premise servers with Azure ...
Go into IIS Manager and point the file path to the new version of the application. As you can see and may have...
Read more >
Error Code: ERROR_FILE_IN_USE msdeploy.exe failed with ...
2018-07-25T14:26:46.9435201Z ##[error]Failed to deploy web package to IIS website. ... dll' on the destination because it is locked by an external process. In ......
Read more >
On-Premise Windows Set up | IIS Configuration issue?
Dear all, I have a Windows Server 2019 VM and I've managed to deploy my test app on it with Mendix Service Console...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found