Azure App Service Slot Swaps Causing Restarts

Bray Modal 0 Reputation points
2026-01-19T00:55:29.71+00:00

We have a .NET Core 9 app for which we have set up a staging slot. Both the "production" and "staging" slots have the same app settings. We additionally added "WEBSITE_ADD_SITENAME_BINDINGS_IN_APPHOST_CONFIG=1" and "WEBSITE_SKIP_ALL_BINDINGS_IN_APPHOST_CONFIG=1" as suggested by different articles. However, whenever we do a swap, the apps restart and defeat the whole purpose of having a staging slot. What else could be causing the apps to restart?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Shree Hima Bindu Maganti 6,660 Reputation points Microsoft External Staff Moderator
    2026-01-19T15:38:45.23+00:00

    Hi @Bray Modal
    I see you’re experiencing restarts when swapping your Azure App Service slots.

    Swapping slots can trigger application restarts due to factors like hostname binding changes, socket state, or resource state even if app settings are the same. Common causes include user-initiated restarts, configuration changes, slot-specific settings, scaling, or Azure maintenance.

     Use the Diagnose and solve problems blade in the Azure portal and run the Web App Restarted detector to find out why and when restarts occur.

     Implementing health checks can help Azure determine if your app is ready for requests, especially if it relies on external dependencies that need time to load.

    Make sure settings like WEBSITE_ADD_SITENAME_BINDINGS_IN_APPHOST_CONFIG=1 and WEBSITE_SKIP_ALL_BINDINGS_IN_APPHOST_CONFIG=1 are set in all slots to avoid binding conflicts.

    Storage events or discrepancies after a swap can cause worker process restarts. Check that your app responds to health checks and HTTP pings before and after swaps, and review eventlog.xml in D:\home\LogFiles\ for errors that might explain the restarts.
    Set up staging environments in Azure App Service

    Diagnose web app restarts

    Health check in Azure App Service
    Let me know if you have any further assistances needed.


  2. Michele Ariis 7,205 Reputation points MVP
    2026-01-19T08:45:31.3266667+00:00

    Hi, slot swaps on App Service are never truly “no restart”. A swap replaces the site’s configuration and content mapping under the hood, so the worker process gets recycled. Those two WEBSITE_APPHOST_CONFIG settings only affect IIS/hosting bindings behavior and don’t prevent a recycle.

    What you can do is minimize the impact: make sure all settings that should not change are marked as slot settings, avoid swapping anything that forces config reload (connection strings, identity settings, auth settings), and use “swap with preview” to warm up the target slot before completing the swap. But a process recycle during swap is expected behavior on App Service, so the goal is “no downtime” via warmup, not “no restart”.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.