News

Containerized Blazor: Microsoft Ponders New Client-Side Hosting

Microsoft is exploring built-in container support for client-side Blazor WebAssembly apps.

The initial stages of that investigation include a Twitter question associated with a feature request on the company's Developer Community feedback site.

That question reads: "If you are doing #Blazor Wasm projects that are NOT aspnet-hosted, how are you hosting them? Would this be useful for you -- comment on the issue and what you might expect in the containerization of a Blazor Wasm project?

The tweet points to the "Docker support for Blazor WASM Projects" feature request on the feedback site, posted Oct. 27 by Microsoft's Brady Gaster. It reads:

With most Web projects, one can right-click the project and elect to add Docker support. With Blazor WASM standalone projects, the Add Docker support flyout is missing. It would be great if we could either:

  1. Add Docker support to for Blazor WASM projects, and drop in a base package that can serve the WASM app. We could use a simple nginx container or a pre-bult Kestrel image.
  2. Add a flyout menu for Blazor WASM projects one can click that would drop in a 'host project' so folks who start with the WASM project can add a host after-the-fact, and it'd be pre-wired to serve the WASM app.

Heuer's same-day tweet, posted to solicit more feedback, has received responses from just a couple developers, one noting that such apps can be hosted as a static web page. Heuer responded: "Yep (note: I work on this team and help deliver the tools 🙂). But if someone wanted to do this (because of their reasons) I'm solicitations [sic] what they'd expect."

Indeed, it was Heuer himself who authored the 2020 article, "Hosting Blazor WebAssembly in Azure Static Web Apps (Preview)."

That static-site functionality was actually proposed on the Developer Community site last year with a post titled "Visual Studio supports creating, debugging and deploying apps to Azure Static Web Apps" and has been placed on the Visual Studio roadmap.

Otherwise, there was no valid feedback to Heuer's post or the Oct. 27 Developer Community post.

blazor
[Click on image for larger view.] Blazor (source: Microsoft).

As far as ASP.NET Core Blazor hosting models, prior to ASP.NET Core 6.0 they included Blazor Server and Blazor WebAssembly, the latter for browser-based client-side apps. With ASP.NET Core 6, Blazor Hybrid was added, wherein Razor components run directly in the native app (not on WebAssembly) along with any other .NET code and render web UI based on HTML and CSS to an embedded WebView control through a local interop channel, Microsoft says.

Outside of ASP.NET Core, other hosting models are scarce and unofficial.

However, among numerous individual projects attempting to containerize Blazor apps is one effort from Blazor expert Chris Sainty: "Containerizing a Blazor WebAssembly App." It followed a project in which he containerized a Blazor Server app. He said that while creating a dockerfile for a Blazor Server app was pretty trivial, that's not the case on the client side of things.

"Blazor WebAssembly projects present us with a different challenge, when published they produce static files," he said. "Unlike Blazor Server apps, we don't need the ASP.NET Core runtime to serve them. This means we can drop the ASP.NET Core runtime Docker image we used in part 1 as the base for our final image. So how are we going to serve our files? The answer is NGINX."

He explained that the free and open source nginx web server can also be used as a reverse proxy, load balancer and HTTP cache, being able to serve static content fast while using significantly less memory when compared to Apache and able to handle up to four times the number of requests per second.

Also, nginx was proposed as the answer to a problem faced by a developer who couldn't get "Blazor client in Docker container" to work and sought help on the Microsoft Learn site. The accepted answer to the problem included this (no editing): "a blazer web assembly app is a static website. it requires a Web server to host it. so to deploy to docker container, you need to pick a container with web server support (typically ngnix), and copy the wwwroot folder to a location folder defined in the webserver."

As noted above, nginx was proposed as part of a potential Microsoft-backed solution, along with Kestrel and other options.

Based on the tepid feedback received on Heuer's tweet (two developers, one off-topic) and the Developer Community post (zero developers), it doesn't appear adding right-click Docker support for Blazor WebAssembly apps in Visual Studio is a big issue among the ranks, so Microsoft might not do anything at all. Stay tuned to find out.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Using Local AI to Cut Copilot Usage-Based Billing Shock

    After being gobsmacked by the new billing plan using almost all my monthly credits in one or two days, I tried pushing some Copilot-style coding work onto local models in VS Code. What I found was less "free AI" and more "pick your pain": cloud charges on one side, heavy local resource use and long waits on the other.

  • .NET 11 Preview 5 Focuses on Performance, Productivity and Safer Code

    .NET 11 Preview 5 focuses on under-the-hood runtime performance gains, streamlined APIs and language features that reduce boilerplate, plus built‑in security checks and incremental ASP.NET Core and EF Core improvements aimed at everyday developer productivity.

  • VS Code 1.124 Focuses on Agent Autonomy and Parallel Sessions

    Microsoft's June 2026 VS Code update turns on Autopilot by default and adds background sending for agent sessions.

  • Developing Agentic Systems in .NET: From Concept to Code

    ZioNet founder Alon Fliess previews his Visual Studio Live! San Diego session on building true agentic systems in .NET -- covering the cognitive loop, MCP tool integration, multi-agent orchestration and enterprise hosting and governance with the Microsoft Agent Framework.

Subscribe on YouTube