HI @Josh Levett
Thank you for sharing additional information in the private chat. Based on your input, now have a clear understanding of the situation from our deep investigation.
What’s happening
Your staging slot is experiencing a known .NET and App Service file-locking issue that occurs when the site runs from a package (ZIP deploy / Run-From-Package). During startup, IIS attempts to shadow-copy assemblies, but if DLLs are locked, shadow-copy fails. As a result, IIS restarts the w3wp process, causing the slot to remain in a “Stopped” state for several minutes, which leads to repeated auto-swap failures, 100% CPU spikes, and long delays.
The symptoms you mentioned match this issue:
- The 40% “missing” CPU is due to the staging w3wp not being fully registered
- The slot frequently switches between Stopped and running states
- CrashDumpAnalyzer crashes because the dump file is locked by the hung worker process
To resolve the issue promptly, implementing any of these three options will provide an immediate solution
- The recommended and simplest approach is to disable Run-From-Package on the staging slot, and on the production slot if desired. Please add the following app setting to both slots.
This adjustment allows the package to extract as expected, rather than remaining read-only, and fully resolves the locking issue.WEBSITE_RUN_FROM_PACKAGE = 0
- If you wish to retain Run-From-Package for its advantages, such as supporting immutable deployments, please include the following:
MSDeploy will rename any locked files rather than causing the deployment to fail.MSDEPLOY_RENAME_LOCKED_FILES = 1
- To completely disable shadow-copying, regardless of whether Run-From-Package is used, please add the following setting to your web.config file:
<hostingEnvironment shadowCopyBinAssemblies="false" />
Reference :
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-8.0#shadow-copy
https://learn.microsoft.com/en-us/azure/app-service/deploy-run-package
https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-http-502-http-503
Kindly let us know if the above comment helps or you need further assistance on this issue.
Please "upvote" if the information helped you. This will help us and others in the community as well.