Can I do a swap on a Blazor Server App service without disconnecting users?

Sean Wauchope 30 Reputation points
2023-05-21T03:57:28.9233333+00:00

I run an App Service hosting a Blazor Server Application. The App service has a staging and production slot. When I do a swap from staging to production I would like users to remain connected and have 0 downtime. Is this possible? The application also connects to Azure SignalR Service. Currently it takes around 2-4 minutes to complete the swap during which time the application is offline.

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,499 questions
Azure SignalR Service
Azure SignalR Service
An Azure service that is used for adding real-time communications to web applications.
136 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,397 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Bruce (SqlWork.com) 61,491 Reputation points
    2023-05-21T15:20:37.3433333+00:00

    No it’s not possible. All the state information is memory, and tied to the circuit (websocket connection). this is lost when you switch server process.

    you can have the server persist state, and add reconnection logic to client app via JavaScript. See modify the reconnection handler

    https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-7.0


  3. Michael Washington 911 Reputation points MVP
    2023-05-22T17:07:16.41+00:00

    I do Azure swaps all the time. It does not take 2 minutes. It usually takes 30 seconds on a busy site. All my users stay connected because an Azure swap is on the same process.


  4. Bruce (SqlWork.com) 61,491 Reputation points
    2023-06-02T17:29:03.8466667+00:00

    You should code a re-connect solution if you don't want user downtime.

    You will get the same issue if the user switches to another tab for a period of time. The browser will close the websocket (signal/r) connection. This after a server timeout will close the circuit. When the user switches back to the tab, you will have the same lost circuit error.