Does anyone know if there's an easy way in Blazor to have:
It all needs to be hosted by the same process.
I've tried two different ways and can't get this working correctly, each way almost does it but then hits problems.
AdminLayout.razor and MainLayout.razor<script src="@Assets["_framework/blazor.web.js"]"></script> into AdminLayout.razor and then every component that uses this layout have @rendermode InteractiveServer.This almost works, you have to ensure you use data-enhance-nav=false while linking from admin -> home otherwise the blazor enhanced nav leaks into it, but it's not a huge problem.
The real problem with this is: AdminLayout.razor can't have InteractiveServer rendermode because it's a layout, and therefore you can't have any InteractiveServer components wrap @body? So for example, one of MudBlazors interactive components in the layout wraps @body I couldn't get it to be interactive. You can supply the rendermode on components not wrapping body but otherwise not?
Create a second Razor Class Library for the admin pages including its own AdminApp.razor and AdminRoutes.razor. Register both in program.cs:
app.MapRazorComponents<App>();
app.MapRazorComponents<AdminApp>()
.AddInteractiveServerRenderMode();
Then you can use InteractiveServer rendermode on both <AdminRoutes and in your admin layout... but now ResourcePreloader and ImportMap don't work because the static assets are built into the main project, not the razor class library.
The other test suggested was to host the different blazor in different _Host.cshtml / _AdminHost.cshtml files and do it that way but I couldn't get this working at all. I could get it to host single razor components but not a full blazor 'app'.
This seems like a pretty vanilla use case; blazor static SSR on the user facing pages, blazor InteractiveServer on the admin panel where latency/SEO doesn't matter at all, but I couldn't make it work even after reading all the MS Docs. Any ideas?
Placing @attribute [ExcludeFromInteractiveRouting] on any page excludes it from interactive routing.
The Blazor templates do this with the Account pages.
The template places this in \Components\Account\Pages\_Imports.razor. This then is included in all pages within that directory.