question

MikeRowley-6111 avatar image
0 Votes"
MikeRowley-6111 asked ·

Visual Studio Publish to Azure Linux App Service Fails

I am getting an error trying to publish to an Azure Linux App Service the second time I publish.

The first time after the service is created it works, subsequent updates fail with:
Unable to add XXXX.dll to the Web site. The process cannot access the file because it is being used by another process (550).

If I turn on Delete Existing files, the publish fails with:
Error deleting file runtimes. Cannot remove folder runtimes/unix/lib/netcoreapp2.1

I have even gone so far as to delete the App Service and recreate it from scratch and get the exact same errors after the initial publish. I have also tried to FTP via FTP Client to the site and manually delete the runtimes/unix/lib/netcoreapp2.1 folder and get an error manually deleting it as well.

I am publishing a netcoreapp3.1, framework independant portable runtime with a release configuration via FTP using the publishing profile downloaded from the Azure Portal.

It seems like a problem in Azure with permissions or files not being properly released or something.
Any suggestions on what the problem is or how to resolve it?

azure-webapps
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I have subsequently discovered that if I stop the Azure App Service I am able to publish the app successfully. Is this really how it is supposed to work or should Azure handle the update without manually stopping the service?

0 Votes 0 ·

1 Answer

SnehaAgrawal-MSFT avatar image
0 Votes"
SnehaAgrawal-MSFT answered ·

Thanks for asking question! If I understood right the updates fail with: Unable to add XXXX.dll to the Web site when trying to publish to an Azure Linux App Service. If so to fix this add the appOffline=true to the ARM template or use the AppOffline switch to the MSDeploy.exe command line.

Also, another option you may try is to rename locked files.

Set MSDEPLOY_RENAME_LOCKED_FILES=1 to Azure App Setting on your app. This causes msdeploy to attempt to rename DLLs if they can't be copied during deployment. This often works because even when DLLs are loaded, they can typically still be renamed. It renames them with a .delete extension, which it then cleans up on the next round.

You may refer to below link for more details on this:

https://github.com/projectkudu/kudu/wiki/Dealing-with-locked-files-during-deployment

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.