aspnetcore: Deployment fails due to file in use
Copy of issue #694, because it was closed even though this problem is still unresolved and @Eilon ignores comments that it’s still unresolved.
By @pekkah:
Any workaround for this problem when deploying to Azure web site from VSO build server vNext?
Error Code: ERROR_FILE_IN_USE More Information: Web Deploy cannot modify the file 'AspNet.Loader.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.
I tried adding a restart azure website command before the deployment but this seems to be still creeping in too often.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 19
- Comments: 17 (3 by maintainers)
@shirhatti - Here’s an entire thread of people telling you that app_offline doesn’t work, without extensive manual intervention:
#3793
It seems these two are duplicates, and this is a clone of an older, unsolved issue.
I’ve been getting it repeatedly while trying to update our first 2 services in Azure, so Azure isn’t a magical fix either.
Can we expect any progress on this? Our company is looking to pivot to microservices right now, and we’ve got pressures to move to node.js because “.Net Core isn’t mature” - issues like this don’t help me make my case for preserving our current .Net based workflows.
If I’m publishing a .Net Core code, using Microsoft tools (Visual Studio), to a Microsoft platform (Azure) - I shouldn’t be facing UX issues like this if you’re serious about building a leading-class development platform.
These are the kind of issues I expect from Eclipse IDE + Java a decade ago, not Visual Studio and .Net Core in 2019
I provide some help on a community forum and, occasionally, there are people complaining about how ASP.NET Core is advertised as a modern framework and all, and then its publishing story is sub-optimal. And they’re absolutely right.
@shirhatti And that’s fine, but you’ll seriously have to consider a solution for us IIS people who want to achieve 0 downtime when updating our application. Not everyone lives in the Azure part of town and I don’t want to be considered as a second-class citizen.
Here’s a suggestion: support deployment slots in ASP.NET Core Module.
And this is how it might work:
SlotA
andSlotB
;SlotA
subdirectory, along with itsweb.config
file;web.config
in the root directory. Here’s how it might look, it describes two deployment slots:SlotA
subdirectory and routes requests forwww.example.org
to it.SlotB
. The ASP.NET Core module notices a change in the directory and starts this application as well, and routes requests forstaging.example.org
to it;web.config
in the root directory. The slots have been swapped like this.SlotB
has now becomeProduction
.www.example.org
toSlotB
, while previously they were routed toSlotA
.And that’s it. I can then script some commands to publish a
app_offline.htm
to the slot I want to update, then remove it, then update theweb.config
in the root to swap slots.To improve it even further, each
slot
element could containt some configuration that stick to the slot, used to define enviroment variables like “CONNECTION_STRING”.