Shared : Presentation Blazor Server
The Shared.Presentation.BlazorServer project provides the configuration extensions specific to Blazor Server applications. It includes helpers for registering Blazor Server services, configuring the middleware pipeline, mapping endpoints, and setting up cookie-based culture switching.
Dependency Injection
The dependency injection extensions provide configuration helpers for Blazor Server service registration and middleware setup :
- ServiceCollectionExtension : Provides the
AddBlazorServerServicesmethod that registers Razor components with interactive server rendering and enables response compression over HTTPS. - WebApplicationExtension : Provides three methods :
UseCookieCulturemaps a/SetCultureendpoint that sets the localization cookie,UseBlazorServerPipelineconfigures the middleware pipeline (HSTS, status code pages, HTTPS redirection, response compression, antiforgery), andUseBlazorServerEndpoints<TApp>maps static assets and Razor components with interactive server render mode.