Blazor Interactivity

Blazor lets you ship a portal in one of three interactivity modes — Server, WebAssembly, or Auto. The mode picks how interactive components run (over a SignalR connection on the server, as compiled .NET in the browser, or both) and decides what gets generated in your project layout. Power Portals Pro runs correctly under all three; the differences are in deployment shape and project wiring, not in framework features.

The Three Modes

Server

Interactive components execute on the server. Each connected user holds an open SignalR connection back to the host, and every UI event round-trips to the server.

Tradeoffs:

WebAssembly

Interactive components run in the browser as compiled .NET code. The server's job shrinks to serving static files and the framework's HTTP API endpoints under /api/auth/* and /api/*.

Tradeoffs:

Auto

The first paint comes from the server (so the user sees content immediately) and the runtime transparently swaps to WebAssembly once the client bundle finishes downloading. Auto = Server first, WebAssembly afterwards, on the same routes.

Tradeoffs:

Tip

This documentation site runs in Auto mode. Open the browser dev tools' network tab on first load and you'll see the server-rendered HTML arrive first, then the WASM bundle stream in over a second or two — after which navigations stop hitting the server for HTML.

Which to Pick

Rough rules of thumb when there's no specific constraint forcing a choice:

Cheat Sheet

What changes between the three modes, file-by-file. Use this as the reference when comparing a generated project to one of the templates, or when chasing down a discrepancy after a manual switch.

Project Layout

All three modes generate a server host project AND a sibling .Client project. What differs is the .Client's SDK and whether it's actually compiled to a WebAssembly bundle.

.csproj Differences

The .Client project's SDK changes, and the WebAssembly-specific framework packages only appear when the host actually runs WASM:

Additional package references when WebAssembly or Auto is active:

Server Program.cs — Service Registration

AddRazorComponents() picks up the appropriate render-mode component pairs based on which builder methods are chained:

Server Program.cs — Endpoint Mapping

MapRazorComponents<App>() chains the matching render-mode endpoints:

App.razor — Per-Route Render Policy

The PageRenderMode getter in App.razor decides which renderer each route uses. Server hosts return Server everywhere; WebAssembly and Auto hosts have to pin the /Account/* routes explicitly so the WASM-only IAuthService resolves:

Why /Account/* is pinned

Auto's first paint runs under the Server renderer, but the Account pages' IAuthService is only registered in the WASM client's DI graph. Without the explicit pin to InteractiveWebAssemblyRenderMode(prerender: false), an Auto host fails to resolve [Inject] IAuthService on the cold-session prerender. prerender: false skips the server-side prerender step entirely so the page renders only once, on the WASM runtime.

.Client/Program.cs — Only When Interactive

Server-only hosts don't have a .Client/Program.cs at all (the .Client is a Razor class library). WebAssembly and Auto hosts include this file, which sets up the WASM runtime, registers the HttpClient with cookie credentials forwarding, registers Power Portals Pro's WASM client services, and pre-fetches cross-cutting localization at startup:

Identity / Account Pages

Power Portals Pro ships two parallel sets of Account pages — one for each render context. Which set is in your project depends on the host's mode:

Next Steps

If you already have a project on one mode and want to convert to another, see the Switch Blazor Interactivity page for the file-by-file changes.