Deployment
A Blazor Web App deploys like any ASP.NET Core app — with a few extra settings for interactive render modes.
On this page · 5 min · Advanced
On this page
- Learning objectives
- Explanation
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Advanced
- Updated
- Oct 29, 2026
Related tutorials
Learning objectives#
- Publish a release build
- Deploy to Azure App Service
- Scale Interactive Server apps
- Host standalone WebAssembly as static files
Explanation#
dotnet publish -c Release produces the deployable output, including WebAssembly files for the .Client project.
Interactive Server needs WebSockets enabled (and ARR affinity/sticky sessions when running multiple instances), or Azure SignalR Service to manage connections.
Standalone Blazor WebAssembly apps are just static files: host them on Azure Static Web Apps, GitHub Pages or any web server with an SPA fallback.
Code example: Deploy to Azure App Service#
dotnet publish -c Release -o publish
az webapp create -g rg-shop -p plan-shop -n app-shop-ui --runtime "DOTNETCORE:9.0"
az webapp config set -g rg-shop -n app-shop-ui --web-sockets-enabled true --always-on true
az webapp update -g rg-shop -n app-shop-ui --client-affinity-enabled true # sticky sessions for circuits
cd publish && zip -r ../ui.zip . && cd ..
az webapp deploy -g rg-shop -n app-shop-ui --src-path ui.zip --type zip
https://app-shop-ui.azurewebsites.net serves the Blazor Web App with working Interactive Server pages.
This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.
Step-by-step explanation#
- publish creates an optimised Release build.
- WebSockets give circuits the best transport.
- Client affinity keeps each user on the instance that holds their circuit.
- Zip deploy uploads the build.
Real-world use case#
An internal Blazor admin portal on App Service, deployed by GitHub Actions on every merge.
Common mistakes#
SignalR falls back to long polling — slower and heavier. Enable WebSockets.
Users lose their circuit when routed to another instance.
Best practices#
- Automate with CI/CD
- Enable WebSockets and Always On
- Use Azure SignalR Service for many users
- Enable compression for WebAssembly files
Remember this#
dotnet publish -c Release.
Interactive Server: WebSockets + sticky sessions.
Standalone WASM = static files + SPA fallback.
Practice exercise#
Your task: Why does an Interactive Server app need sticky sessions when scaled to two instances?
Show solution
Each user’s circuit (component state) lives in one server’s memory. Requests must keep going to that server, or Azure SignalR Service must manage the connections.
Mini quiz#
Which App Service setting should be enabled for Blazor Interactive Server?
Want more? Practise all Blazor MCQs · Blazor interview questions
My notes#
Saved in this browser.