When I swap from production slot to testing slot in the App Service, my production URL doesn't work in azure WebApp.

Darshan Sreedhar 0 Reputation points
2024-02-29T12:03:45.52+00:00

prod server

Hello, We have configured GitHub in the Deployment Center for the testing slot, but we cannot access testing and production URLs at the same time. We have another WebApp and that perfectly works fine, but the new one that I've created is not working with both the prod and testing URLs at the same time. So after swapping from production slot to the testing slot, the production URL won't work but the testing URL works, and after swapping from the testing slot to the production slot, the production URL works but the testing URL won't work.

I've configured the environment variables as expected, I've enabled all the Deployment Slot Settings in the configuration tab, but I'm getting the above page as if I've not pushed the code to the server. Please help!!!!

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,971 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,178 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Dan Rios 2,020 Reputation points MVP
    2024-03-06T19:06:45.5633333+00:00

    Hey

    This sounds to me like expected behaviour. What I mean by that is the way the slot swap works is if you’ve deployed the code to your staging slot and swap this to production, the staging slot will now be whatever was last on that production slot in terms of code. If the last code was just the default app service code then that’s what will be on the swap.

    You need to deploy your code again to the slot so both have matching code. That way, when you deploy changes next time and swap you will have a revert method to the old working state in addition to the zero downtime deployment benefit.

    You can read more here: https://learn.microsoft.com/en-us/azure/app-service/deploy-staging-slots?tabs=portal#what-happens-during-a-swap

    1 person found this answer helpful.
    0 comments No comments

  2. Grmacjon-MSFT 19,301 Reputation points Moderator
    2024-03-27T12:50:44.1+00:00

    @Darshan Sreedhar adding to Dan's helpful answer - the issue you're facing with accessing both the testing and production URLs of your Azure App Service at the same time after deployment through GitHub in the Deployment Center could stem from a few potential causes.

    First, double-check the Deployment Center settings for slot swap behavior. Ensure the "Swap" option is selected instead of "Recreate" during deployment. "Recreate" deletes and recreates the entire slot, potentially causing downtime and losing the state of the other slot.

    Next, review the deployment configuration in the Deployment Center. Ensure app settings specific to each slot (e.g., database connection strings) are properly defined and inherited correctly during deployment.

    • Clear browser cache: Sometimes, cached resources from the previously accessed slot can interfere with accessing the other slot. Clear your browser cache and hard refresh the desired URL (Ctrl+Shift+R) to ensure you're loading the latest version.

    If you haven't already, try to enable logging in your application to capture any errors or warnings that might be occurring during the swap or when accessing the swapped slot.

    0 comments No comments

Your answer

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