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:
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user