Add BlazorServerOptions for SignalR message size config

Introduced a new `BlazorServerOptions` class to manage Blazor Server runtime configuration. Added support for configuring the maximum SignalR message size via `appsettings.json` under the `BlazorServer` section. Updated `Program.cs` to apply this configuration to SignalR hub options and register `BlazorServerOptions` with the DI container.
This commit is contained in:
2026-11-23 15:33:08 +01:00
parent f123d9e785
commit 530bb7055a
3 changed files with 29 additions and 0 deletions

View File

@@ -55,9 +55,16 @@ try
var deferredProvider = new DeferredServiceProvider();
var blazorServerOptions = config.GetSection(BlazorServerOptions.SectionName)
.Get<BlazorServerOptions>() ?? new BlazorServerOptions();
// Add Blazor services
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddHubOptions(options =>
{
options.MaximumReceiveMessageSize = blazorServerOptions.MaximumReceiveMessageSize;
})
.AddInteractiveWebAssemblyComponents();
builder.Services.AddMudServices();
@@ -294,6 +301,7 @@ try
builder.Services.AddCookieBasedLocalizer();
// Cache options
builder.Services.Configure<BlazorServerOptions>(config.GetSection(BlazorServerOptions.SectionName));
builder.Services.Configure<CacheOptions>(config.GetSection(CacheOptions.SectionName));
builder.Services.Configure<SenderFeatureAccessOptions>(config.GetSection(SenderFeatureAccessOptions.SectionName));