Azure deploy to web application failing on locked files

Hi guys,

We’ve been using Octopus deploy with our Azure web apps for some time now without error but recently (without change to Azure) one web deploy is constantly failing. The failure is on a locked file that (almost always) fails on ‘msvcr100.dll’ and (sometimes) on ‘Microsoft.CodeAnalysis.CSharp.dll’

This is a web app that uses the Deploy an Azure Web App step. I’ve got it set to enable the AppOffline feature and remove additional files that are not part of the deployment (I’ve tried this option both checked and unchecked with the same results). Otherwise the step is pretty basic. The frustrating part is we have two different web projects deploying from this solution, one for an API and the other for the public website. It’s the API deploy that constantly fails while the website constantly succeeds.

There was some discussion about using PowerShell to customize the deploy and shutting down the website before deploy, but that’s awkward because a) it means I couldn’t use the out-of-the-box Azure deploy and not script the entire deployment which is a pain to maintain new scripts and b) we would rather try to keep the website up as much as possible during deployments. It’s not high usage but I’m not fond of presenting a 500 error to users or consumers of the API. There’s swapping deploy slots of the website (that would probably solve this) but these are additional steps that we haven’t needed before and I’m hesitant to change the processes and services we use to try to solve this (since it’s only started recently).

Looking for some good ideas to solve this in as much of a friction free solution or peoples experience with this.


Just as an update, the only solution I have for this is to stop the web app, deploy, then start the web app up again. Not the best solution but works (and I’m doing it manually right now whenever the deployment fails, which in the development environment is a few times a day).

Hi Bill,

Thank you for getting in touch! Unless your application has some explicate dependency on native code then the dlls you mentioned would indicate that something is attaching to your application at runtime.

Are you using NewRelic or any other tool that might be using CLR Profiling API? If so, can you disable it and try again? If it still fails, can you create a brand new Azure Web App and try again?

Please let me know how it goes.


Hi Pawel,

We are not using NewRelic or any other tool that I know of that’s profiling the CLR. We do have the system front-ended by API Manager but that’s about it, so there’s nothing to disable. Also creating a new Azure Web App and doing the deploy won’t really help me. We already have another web app where it is working so I know the know the deployments to Azure are working fine, it’s just with this app (in all environments, so it’s not just one) is having these lock issues. The work around is I have some Azure Powershell that stops and starts the web site before and after the deployment. It’s not optimal as the system takes an outage. I may have to look into using deployment slots for this site to offset that in the production environment.


Hi Bil,

Thanks for your reply. Hopefully deployment slots will solve your problem.