Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Function: Publish fails with message "Web Deploy cannot modify the file on the Destination because it is locked by an external process."

I am developing an Azure Functions Project and when I publish first time, OK. Then I publish again, this Error appears:

Web Deploy cannot modify the file 'FunctionApp5.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.

It only Publishes if I enter Azure portal, and Restart this Azure Function App

Azure Portal and Visual Studio 2017

like image 214
Tony Avatar asked Jan 18 '18 20:01

Tony


2 Answers

Set

MSDEPLOY_RENAME_LOCKED_FILES=1 

in the Azure Function Application Settings usually resolved this

Configure

This can also be done in Visual Studio on the Publish -> Application Settings:

Application Settings

like image 94
Tony Avatar answered Oct 16 '22 22:10

Tony


Following this article, you could also try adding this directive in your Web Deploy pubxml to instruct taking the Function app offline while deploying:

<EnableMsDeployAppOffline>True</EnableMsDeployAppOffline>

like image 4
Jeetesh Mangwani Avatar answered Oct 16 '22 22:10

Jeetesh Mangwani



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!