Azure App Service - Slot swapping files get locked


The erorr occurs when there is an acctive traffic to the service 1. Deploy o staging 2. Swap slot with prod 3. application return 502

logs shows

Microsoft.AspNetCore.DataProtection.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)

The error message is not consistent, it could be Swagger DLL was locked or System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.

the big question is. Are slots sharing same files ? how does exactly works ? I ssume that each slot is a separate App .

asked on Stack Overflow Sep 8, 2017 by Dorin • edited Feb 15, 2019 by Md Farid Uddin Kiron

1 Answer


Might be of interest to others, but I added a line to restart the web app (production slot), after swapping.

az webapp restart -g ResourceGroupName -n AppServiceName
answered on Stack Overflow May 25, 2021 by Clay Lenhart

User contributions licensed under CC BY-SA 3.0