Client-Side ASP.NET MVC Runtime for WebAssembly #65501
Replies: 1 comment
-
|
A new, simplified, and fully abstracted repository is now available to make it easier for the .NET team and the community to explore the core concepts behind this proposal: 🔗 NetWasmMVCRuntime (Conceptual & Minimal Runtime Spec) This repository provides a clean, high‑level representation of the client‑side MVC runtime model without the additional tooling, SDK packaging, or CLI layers found in the full implementation. It is designed specifically to help reviewers understand:
The full production‑grade implementation remains available here: 🔗 WasmMvcRuntime (Complete SDK + CLI + Runtime) Together, these two repositories provide both a conceptual overview and a full working implementation, making it easier for the .NET team to evaluate the proposal from both architectural and practical perspectives. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
This proposal introduces a client-side ASP.NET MVC runtime that executes Controllers, Razor Views, Routing, EF Core (SQLite), SignalR, and Identity entirely inside a WebAssembly Web Worker — with zero server dependency at runtime.
Developers write standard MVC code — Controllers,
.cshtmlViews,ViewData/ViewBag/TempData, Tag Helpers, Areas — and the SDK compiles it into static files deployable to any CDN, edge network, or embedded WebView.The Problem
ASP.NET MVC is the most widely adopted .NET web programming model — yet it has no client-side story.
Proposed Solution
A new SDK target that compiles ASP.NET MVC for execution inside a WebAssembly Web Worker:
The developer writes standard MVC code — no new paradigm to learn:
dotnet publishproduces static files. No ASP.NET server required at runtime.How it works: The .NET runtime boots inside a Web Worker, keeping the UI thread free. An MVC engine handles controller discovery, route matching, and action invocation. A pattern-matching Razor engine renders
.cshtmlviews from embedded resources. The rendered HTML is sent to the main thread as frames applied viarequestAnimationFrame. SQLite databases and session state persist to the Origin Private File System (OPFS). All C#↔JS communication uses JSImport/JSExport — no dependency on Blazor's infrastructure.What's included
Controllerbase class,ViewData/ViewBag/TempData/ModelState,ViewResult/PartialViewResult/JsonResult/RedirectResult, attribute routing,[Area],[ApiController], convention-based routing.@Model,@ViewData,@if/@foreach,@RenderBody(),@RenderSection(),@Html.PartialAsync(),asp-controller/asp-actiontag helpers.Clients.All/Caller/Others/Group(), connection management — all in-process.cepha new,cepha dev,cepha publish,cepha kit(Cepha.CLI).How this complements Blazor
This is not a replacement for Blazor. Blazor excels at rich interactive UIs with fine-grained reactivity. MVC WASM excels at document-oriented apps, admin panels, and CRUD applications where the existing MVC skillset should transfer directly to client-side deployment — without rewriting views as components. Both models share the same .NET WASM runtime and could coexist.
Why This Belongs in .NET 11
The runtime foundation is ready. .NET 10 ships mature WebAssembly support:
dotnet.js, Web Workers, JSImport/JSExport, WASM-compiled SQLite. What's missing is the MVC engine layer on top.NativeAOT for WASM is coming. .NET 11 is expected to advance NativeAOT/Trimming for WebAssembly, which would reduce the current ~15-25MB bundle to a competitive size. This proposal aligns with that timeline.
Edge computing is mainstream. Cloudflare Workers, Deno Deploy, Vercel Edge Functions are standard deployment targets. .NET 11 is the window to establish MVC as a viable edge framework.
Developer demand is real. MVC is the Initial checkin of some samples and a readme #1 ASP.NET programming model by adoption. Developers want their existing skills to work in new deployment targets — not a new paradigm.
Feasibility is proven. The reference implementation is published on NuGet with CI/CD, covering Controllers → Views → EF Core → Identity → SignalR. This is not theoretical.
What We Are Asking from the .NET Team
We are not asking for a massive new framework — just targeted infrastructure:
Experimental / .NET 11 Preview
Microsoft.NET.Sdk.WebAssembly.MvcSDK target — embed.cshtmlas resources, link SQLite natively, produce static SPA output. (~200 lines of MSBuild in our implementation.)MvcEnginefor WASM — controller discovery, route matching, action invocation without the full server pipeline. (Single file in our implementation.)ITemplateProvider/IRazorTemplateEngine) — rendering.cshtmlfrom embedded resources.dotnet new mvc-wasmtemplate — scaffolding via the standard template system.Post-Preview
What we are NOT asking for: ❌ Changes to the existing MVC server pipeline · ❌ Changes to Blazor · ❌ A new component model · ❌ Deprecation of any existing feature.
Reference Implementation
📦 Repository: github.com/sbay-dev/NetWasmMVCRuntime
NuGet packages:
NetWasmMvc.SDK—<Project Sdk="NetWasmMvc.SDK/1.0.6">Cepha.CLI—dotnet tool install --global Cepha.CLIKey source files:
MvcEngine.cs·RazorTemplateEngine.cs·Controller.cs·SignalREngine.cs·Identity/·CephaApp.cs·main.js·Sdk/Call for Feedback
We'd love to hear from the community and the .NET team:
If you find this idea interesting, please 👍 this discussion and share your use cases. Community signal helps the .NET team prioritize.
Based on WasmMvcRuntime — an open-source client-side ASP.NET MVC runtime for WebAssembly, published on NuGet and actively maintained.
Beta Was this translation helpful? Give feedback.
All reactions