Azure App Service: why is an old version of the application sometimes used?

Tim Anderson 16 Reputation points
2020-12-29T21:53:46.027+00:00

This is strange. I have a .NET 5.0 application under development, running on Linux, and I deploy it using a DevOps Pipeline that deploys to a staging slot. Then I use Swap in the Azure portal to make the new code live. Recently I found a bug in the deployed version in the production slot. I fixed the bug, deployed to the Staging slot, then performed a swap. However I noticed that the bug was intermittently still not fixed. After troubleshooting I found that going to the page in the application that has the bug, I could refresh and sometimes get the fixed version, sometimes the non-fixed version. To prove this I have a version number at the foot of the page. Refresh sometimes shows the old version, sometimes the new one. I am not sure if the App Service is sometimes erroneously serving the code from the Staging slot (since after the swap this has the old version), or whether there is some sort of old copy in the Production slot that is getting served, but the effect is the same. Has anyone encountered this problem and can tell me how to fix it?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,022 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 27,356 Reputation points Microsoft Employee
    2021-03-18T18:28:21.89+00:00

    To close the loop/updating the findings from offline (support), to benefit the community:

    The issue was identified as not specific to deployment slots. When we have multiple servers connected to same ASRS, this is an expected behavior because the ASRS can connect to any of the application server.

    We can overcome this behavior by specifying ApplicationName in the server SDK for different server groups.

    Suggested workaround to specify ApplicationName in the server SDK for different server groups.

    public void ConfigureServices(IServiceCollection services)
            {
                services.AddSignalR()
                        .AddAzureSignalR(options =>
                        {
                            options.ApplicationName = "app1";
                        }
                   );
            }
    

    By performing the above change, will help server generate URLs like ......?hub=app1_<your_hub> during negotiation which can help ASRS instances differentiate connections coming from different server groups.

    Reference:
    https://github.com/Azure/azure-signalr/issues/825
    https://github.com/Azure/azure-signalr/issues/348

    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.