I have a Blazor Server application, and for the types of users that would typically use it, we want the site to avoid disconnecting every minute or so. It's very likely that a user would open the application, walk away to cook dinner, and come back.
For testing purposes, I set custom values for about twenty (20) minutes on my timeout, and ten (10) minutes for my keep alive interval.
In my Program.cs:
builder.Services.AddRazorComponents().AddInteractiveServerComponents()
.AddHubOptions(options =>
{
options.ClientTimeoutInterval = TimeSpan.FromSeconds(1200);
options.HandshakeTimeout = TimeSpan.FromSeconds(1200);
options.KeepAliveInterval = TimeSpan.FromSeconds(600);
});
And in my App.razor:
But no matter what, my application keeps disconnecting at exactly 30 seconds every time.
blazor.web.js:1 [2026-05-12T22:13:54.579Z] Error: Connection disconnected with error 'Error: Server timeout elapsed without receiving a message from the server.'.
Am I doing something wrong in my code? Have I overlooked (or overthought) how Blazor's timeout system works?