C
C#5mo ago
Angius

Adding Blazor to an existing Razor Pages project

I decided that messing around with SSR and JS for the admin panel is not worth the hassle and I'll just make it with Blazor. I don't care about the bundle size, I don't care about SignalR connections, seems to be a perfect fit. I think I did everything correctly, but I'm still getting errors out the wazoo.
//...
services.AddRazorComponents().AddInteractiveServerComponents();
//...
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseBanMiddleware();
app.UseAntiforgery();
app.UseEndpoints(endpoints => {
endpoints.MapRazorPages();
endpoints.MapControllers();
endpoints.MapOgma3Endpoints();
endpoints.MapGroup("panel")
.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
});
//...
services.AddRazorComponents().AddInteractiveServerComponents();
//...
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseBanMiddleware();
app.UseAntiforgery();
app.UseEndpoints(endpoints => {
endpoints.MapRazorPages();
endpoints.MapControllers();
endpoints.MapOgma3Endpoints();
endpoints.MapGroup("panel")
.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
});
but going to /panel results in the following:
An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Unable to find the provided template 'panel/'
An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Unable to find the provided template 'panel/'
With the whole log being https://pastie.io/bcixjg.yml
2 Replies
Salman
Salman5mo ago
Integrate ASP.NET Core Razor components into ASP.NET Core apps
Learn about Razor component integration scenarios ASP.NET Core apps, Razor Pages and MVC.
Angius
AngiusOP5mo ago
Yeah, that's the one I followed :/

Did you find this page helpful?