"The process cannot access the file,because it is being used by another process" - Only happens with Umbraco 10 sites

We’ve recently started using Umbraco v10 with octopus and when trying to deploy these sites we get the same error on both of them:


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]
at Alphaleonis.Win32.NativeError.ThrowException(UInt32 errorCode, String readPath, String writePath)
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)
at Alphaleonis.Win32.Filesystem.File.Copy(String sourceFileName, String destinationFileName, Boolean overwrite)
at Calamari.Common.Plumbing.FileSystem.CalamariPhysicalFileSystem.RetryTrackerFileAction(Action fileAction, String target, String action)
at Calamari.Common.Plumbing.FileSystem.CalamariPhysicalFileSystem.CopyDirectory(String sourceDirectory, String targetDirectory, CancellationToken cancel)
at Calamari.Common.Plumbing.FileSystem.CalamariPhysicalFileSystem.CopyDirectory(String sourceDirectory, String targetDirectory)
at Calamari.Deployment.Conventions.CopyPackageToCustomInstallationDirectoryConvention.Install(RunningDeployment deployment)
at Calamari.Deployment.ConventionProcessor.RunInstallConventions()
at Calamari.Deployment.ConventionProcessor.RunConventions()
Running rollback conventions...

The only “solution” we’ve found is to manually restart the site and then redeploy, but this is not going to be a good solution in the long term. Why is this happening?

Hi @rass,

Thanks for getting in touch!

I’m unfamiliar with Umbraco, so I’m unsure how that may be factored into this. However, judging from the error, you are deploying to an IIS site, and the application pool is still running and maintaining a lock on the Azure.Core.dll.
This isn’t uncommon when deploying to IIS, and the normal solution would be to add a step before the deployment that stops the application pool, which should then remove the lock on that file.

Regards,
Paul

1 Like

Hi @paul.calvert , I’ve added a step to restart the app pool before deployment and did a test run which seemed to work. Thank you kindly!

2 Likes