Can't connect to the server (after time goes by)

David Thielen 3,116 Reputation points
2024-09-27T16:22:38.1266667+00:00

Hi all;

I am finding a lot that if I leave the browser on one of my pages, after a bit of time goes by it dulls the entire page and at the top it says "Can't connect to the server" and gives me a reload link.

Am I doing something wrong here? Or does this happen with Blazor Interactive Server Mode pages?

These are pages without a form, but they are populated with data from the DB.

thanks - dave

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,575 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 64,826 Reputation points
    2024-09-27T16:46:41.13+00:00

    this means the websocket connection was lost and reconnect failed to find the old circuit. this can happen if in a webfarm and host affinity is not supported/enabled, or the connection has closed for time period.

    if it important to seamlessly reconnect, you can add server code to save state, and at app startup load the saved state and navigate to correct page. then change js to reconnect without the reload link.

    note: modern browsers are getting aggressive about closing websockets when page is not in use. say its not the active window, or the browser is not the active application. Also check if the app pool is recycling.

    1 person found this answer helpful.

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.