I'm testing this Blazor server on our existing ASP.NET Core MVC project using the latest .NET 8.
When running, this error always occurs:
The request matched multiple endpoints. Matches: Blazor static files
I followed the tutorial at Microsoft:
services.AddRazorComponents().AddInteractiveServerComponents();
app.UseStaticFiles();
//blazor
app.MapBlazorHub();
app.MapRazorComponents<App>().AddInteractiveServerRenderMode();
When removing AddInteractiveServerRenderMode()
in MapRazorComponents
, the blazor.js
file is loading but onclick
trigger event is not working
In Net7 and below you use app.MapBlazorHub()
to configure the Blazor Server HTTP request pipeline.
In Net8 [with it's render modes] .AddInteractiveServerRenderMode()
configures the HTTP request pipeline to support the specific render mode.
You can't do both.
Note: .AddInteractiveServerComponents()
configures the necessary services for the specific render mode.