“The process cannot access the file,because it is being used by another process” - Problem with Azure.Core.dll on Umbraco 10 sites

Hi, I posted the same topic about a year ago about an error where on deployment on specifically Umbraco 10 websites (not sure if necessarily relevant) I more often than not recieve this error where it claims Azure.Core.dll is being used and therefore the website cannot be deployed. Last time I posted this I got the suggestion to add a step before the deployment step to restart/stop the application pool of the website which has worked for a while but at this point I need to stop the entire website to be able to deploy and this isn’t sustainable when people are using the website. Any suggestions where to go from here?

System.IO.IOException: (32) The process cannot access the file because it is being used by another process: [\\?\C:\inetpub\wwwroot\website\Azure.Core.dll]
August 7th 2023 15:29:25
Error
at Alphaleonis.Win32.NativeError.ThrowException(UInt32 errorCode, String readPath, String writePath)
August 7th 2023 15:29:25
Error
at Alphaleonis.Win32.Filesystem.File.CopyMoveCore(Boolean isFolder, KernelTransaction transaction, String sourceFileName, String destinationFileName, Boolean preserveDates, Nullable`1 copyOptions, Nullable`1 moveOptions, CopyMoveProgressRoutine progressHandler, Object userProgressData, CopyMoveResult copyMoveResult, PathFormat pathFormat)
August 7th 2023 15:29:25
Error
at Alphaleonis.Win32.Filesystem.File.Copy(String sourceFileName, String destinationFileName, Boolean overwrite)
August 7th 2023 15:29:25
Error
at Calamari.Common.Plumbing.FileSystem.CalamariPhysicalFileSystem.RetryTrackerFileAction(Action fileAction, String target, String action)
August 7th 2023 15:29:25
Error
at Calamari.Common.Plumbing.FileSystem.CalamariPhysicalFileSystem.CopyDirectory(String sourceDirectory, String targetDirectory, CancellationToken cancel)
August 7th 2023 15:29:25
Error
at Calamari.Common.Plumbing.FileSystem.CalamariPhysicalFileSystem.CopyDirectory(String sourceDirectory, String targetDirectory)
August 7th 2023 15:29:25
Error
at Calamari.Deployment.Conventions.CopyPackageToCustomInstallationDirectoryConvention.Install(RunningDeployment deployment)
August 7th 2023 15:29:25
Error
at Calamari.Deployment.ConventionProcessor.RunInstallConventions()
August 7th 2023 15:29:25
Error
at Calamari.Deployment.ConventionProcessor.RunConventions()
August 7th 2023 15:29:25
Error
Running rollback conventions...
August 7th 2023 15:29:25
Error
(32) The process cannot access the file because it is being used by another process: [\\?\C:\inetpub\wwwroot\website\Azure.Core.dll]
August 7th 2023 15:29:25
Error
System.IO.IOException
August 7th 2023 15:29:25
Error
at Alphaleonis.Win32.NativeError.ThrowException(UInt32 errorCode, String readPath, String writePath)
August 7th 2023 15:29:25
Error
at Alphaleonis.Win32.Filesystem.File.CopyMoveCore(Boolean isFolder, KernelTransaction transaction, String sourceFileName, String destinationFileName, Boolean preserveDates, Nullable`1 copyOptions, Nullable`1 moveOptions, CopyMoveProgressRoutine progressHandler, Object userProgressData, CopyMoveResult copyMoveResult, PathFormat pathFormat)
August 7th 2023 15:29:25
Error
at Alphaleonis.Win32.Filesystem.File.Copy(String sourceFileName, String destinationFileName, Boolean overwrite)
August 7th 2023 15:29:25
Error
at Calamari.Common.Plumbing.FileSystem.CalamariPhysicalFileSystem.RetryTrackerFileAction(Action fileAction, String target, String action)
August 7th 2023 15:29:25
Error
at Calamari.Common.Plumbing.FileSystem.CalamariPhysicalFileSystem.CopyDirectory(String sourceDirectory, String targetDirectory, CancellationToken cancel)
August 7th 2023 15:29:25
Error
at Calamari.Common.Plumbing.FileSystem.CalamariPhysicalFileSystem.CopyDirectory(String sourceDirectory, String targetDirectory)
August 7th 2023 15:29:25
Error
at Calamari.Deployment.Conventions.CopyPackageToCustomInstallationDirectoryConvention.Install(RunningDeployment deployment)
August 7th 2023 15:29:25
Error
at Calamari.Deployment.ConventionProcessor.RunInstallConventions()
August 7th 2023 15:29:25
Error
at Calamari.Deployment.ConventionProcessor.RunConventions()
August 7th 2023 15:29:25
Error
at Calamari.Commands.DeployPackageCommand.Execute(String[] commandLineArguments)
August 7th 2023 15:29:25
Error
at Calamari.Common.CalamariFlavourProgram.Run(String[] args)
August 7th 2023 15:29:25
Fatal
The remote script failed with exit code 100
August 7th 2023 15:29:25
Fatal
The action Release Deploy (IIS) on -server- failed

Hi @rass,

Thanks for getting in touch!

At a deployment level, there isn’t really a way to update a website without taking it offline. Whilst the website is running, it will maintain locks on certain files, which prevents them from being overwritten.

The only solutions to this are:

  • Stop the website and release file locks
  • Deploy the new files to a new folder (no overwrite occurs, so no issue with file locks) and update the website to use the new folder, then update the site to use the new folder

The second option here would have less downtime, as the old site would remain online until the new one is deployed and the site location gets updated to the new folder, however, there would still be some interruption when that switch occurs.

Performing a website update with no downtime requires the site and infrastructure it runs on to be designed to support this.

This is a bit of a simplification of things, but one example would be having your site running on multiple targets located behind a load balancer. This would give you the ability to remove one of the targets from serving users, update it, and then make it available again. This form of rolling deployment can be done to eliminate any downtime. There may be other things to consider in this kind of scenario though, such as, if your website has a database backend, can that be updated and allow the old website to continue to run successfully?

Regards,
Paul

Hi Paul!

Thanks for the quick reply. I suppose it’s true you can’t really update a website with zero downtime, I guess my question should be rephrased a bit to “How can we deploy without manually taking the website offline”. We never had the file lock problems before and were able to deploy on the go with little to no downtime.

Thank you for the suggestions for other options though, I will consider these!

The file locking seems to depend on the site itself and what libraries it is using.

In my previous role, I had a similar website deployment that I could deploy without stopping the app pool. But then some updates were made to the site, including some new libraries being used, and suddenly those new files were constantly locked during the deployment, which meant I had to add the stop app pool step from that point onwards.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.