Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure App Service Deploy file in use

In my project we use Azure App Service Deploy task to deploy our webdeploy packages.

I noticed that sometimes I get a file in use error while deploying, even when the option 'Take app offline' has been set on.

What is the best way to fix this ?

This is the error:

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.
like image 472
Patrick Peters Avatar asked Dec 07 '25 19:12

Patrick Peters


2 Answers

You can now use the 'Azure App Service Manage' task to stop and start the app service to prevent files being in use.

enter image description here

like image 164
Geert Doornbos Avatar answered Dec 09 '25 15:12

Geert Doornbos


I have a temporary fix as recommended in this page here

I have made a Azure CLI task using this command before the deploy:

azure webapp stop --resource-group XX --name YY

(where XX is the resource group name, YY the web app service)

Then performing the deploy using Azure Web Deploy Task

Then performing this Azure CLI task after the deploy:

azure webapp start --resource-group XX --name YY

And that works.

like image 34
Patrick Peters Avatar answered Dec 09 '25 14:12

Patrick Peters



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!