Using BlazorKit

BlazorKit is a .NET 11 application template, built on the Oqtane framework, that gives you a complete Blazor web application with pages, in-place content editing, file management, users, roles and themes, ready to extend with your own C# code.
My friend Keith Michael Ashton is a stand-up comedian, and he needed a website. I did not want to hand him a static page that only I could change, and I did not want to set him up with WordPress. I wanted a site he can update himself, especially to post his latest appearances, built on .NET where I am comfortable extending it.
In this article we will install BlazorKit, add Aspire so local development runs against a SQL Server container, add the Oqtane Blog module so Keith can post his appearances, give the site his look, and deploy it to an existing Azure App Service that uses an existing SQL Server.
Note: BlazorKit is new. This article uses template version 11.0.0 with Aspire 17.
Video: Watch the walkthrough on YouTube: Using BlazorKit: Build a .NET 11 Website with Oqtane, Aspire and Azure
Prerequisites
- .NET 11 SDK
- Aspire CLI 17 (install with
irm https://aspire.dev/install.ps1 | iex) - Docker Desktop (running)
- Visual Studio 2026 or Visual Studio Code (optional)
- An Azure App Service (Windows, .NET 11) and a SQL Server database for production
Note: SQL Server containers only run on x64 machines.
Install BlazorKit

The installation instructions are on the home page of blazorkit.net. BlazorKit is a dotnet new template, so we install it once:
dotnet new install BlazorKit.Application.Template::11.0.0
Then we create the solution. The --HttpPort and --HttpsPort options pin the ports, which matters later because Oqtane matches every request against the site's address:
dotnet new blazorkit-app -n KeithMichaelAshton -o KeithMichaelAshton --HttpPort 44358 --HttpsPort 44359
Important: the 11.0.0 template output includes a .git folder and some NuGet packaging files (_rels, package, [Content_Types].xml, .signature.p7s, .nuspec, release.cmd). Generate into an empty folder, and if you are adding BlazorKit to an existing repository, copy over only Client, Server, Shared, .gitignore, the .slnx file, LICENSE and README.md. Otherwise the template overwrites your repository's .git folder.
The solution has three projects:
| Project | Purpose |
|---|---|
| Server | The ASP.NET Core host, site templates, database migrations and appsettings.json |
| Client | Your Blazor modules and themes |
| Shared | Models and interfaces shared by both |
Tip: the template's .gitignore excludes Server/appsettings.json, but the application will not start without it. I removed that line and commit the file, which contains no secrets in this setup.
Add Aspire And A SQL Server Container
In the solution folder we let the Aspire CLI create an AppHost project:
aspire init --language csharp
aspire add Aspire.Hosting.SqlServer
Then we add a ServiceDefaults project and reference it from the Server project:
dotnet new aspire-servicedefaults -n KeithMichaelAshton.ServiceDefaults -o KeithMichaelAshton.ServiceDefaults
dotnet sln KeithMichaelAshton.slnx add KeithMichaelAshton.ServiceDefaults\KeithMichaelAshton.ServiceDefaults.csproj
dotnet add Server\KeithMichaelAshton.Server.csproj reference KeithMichaelAshton.ServiceDefaults\KeithMichaelAshton.ServiceDefaults.csproj
This is the complete AppHost.cs:
var builder = DistributedApplication.CreateBuilder(args);
var sqlPassword = builder.AddParameter("sql-password", secret: true);
var hostPassword = builder.AddParameter("host-password", secret: true);
var hostEmail = builder.AddParameter("host-email");
var sql = builder.AddSqlServer("sql", password: sqlPassword, port: 14330)
.WithDataVolume("kma-sql-data")
.WithLifetime(ContainerLifetime.Persistent);
var db = sql.AddDatabase("DefaultConnection", databaseName: "KeithMichaelAshton");
builder.AddDotnetProject("web", "../Server/KeithMichaelAshton.Server.csproj",
options => options.LaunchProfileName = "https")
.WithReference(db)
.WaitFor(db)
.WithEnvironment("Installation__DefaultAlias", "localhost:44359,localhost:44358")
.WithEnvironment("Installation__HostEmail", hostEmail)
.WithEnvironment("Installation__HostPassword", hostPassword);
builder.Build().Run();
A few things in this code are specific to BlazorKit:
- The database resource is named DefaultConnection. Aspire passes it to the web project as the environment variable ConnectionStrings__DefaultConnection, which is exactly the key Oqtane reads, so there are no changes to the data layer.
- Important: if BlazorKit receives a connection string but no Installation__DefaultAlias, Installation__HostEmail and Installation__HostPassword, it logs an error and exits at startup. With all four values it performs an unattended install on first run and creates the site and the host (super-user) account.
- The fixed port 14330 lets you connect to the database with SQL Server Management Studio, and the named, persistent volume keeps the data between runs. The sa password is stored in that volume, so do not change sql-password afterwards.
- AddDotnetProject is the Aspire 17 replacement for AddProject, and the https launch profile makes Aspire serve the site on https://localhost:44359, the address in DefaultAlias.
In Server/Program.cs we add two lines, builder.AddServiceDefaults(); after the builder is created and app.MapDefaultEndpoints(); after builder.Build().
Important: in ServiceDefaults/Extensions.cs, comment out the AddServiceDiscovery() and ConfigureHttpClientDefaults(...) block. Oqtane modules call the site's own API with HttpClient while the page renders, and the default resilience and service-discovery handlers broke those calls. The Blog module showed An Unexpected Error Has Occurred until I removed them. OpenTelemetry and health checks keep working.
Finally we store the three parameters as user secrets (you will be prompted for the values) and make the AppHost the startup project:
aspire secret set Parameters:sql-password
aspire secret set Parameters:host-password
aspire secret set Parameters:host-email
Tip: always start the AppHost, never the Server project directly. Without the AppHost there is no connection string, the Oqtane installation wizard appears, and it writes your connection string into appsettings.json. I added a Git pre-commit hook that rejects that file if a connection string ever ends up in it.
Run Locally
aspire run

The Aspire dashboard shows the sql container, the DefaultConnection database and the web project. The first start downloads the SQL Server image and takes a minute.

Click the web URL and BlazorKit has already installed itself. This is the default BlazorKit site with its sample Weather Dashboard.
Add The Blog Module For Appearances
Keith wants to post his latest appearances himself, so we add the official Oqtane Blog module as a NuGet package to the Server project:
dotnet add Server\KeithMichaelAshton.Server.csproj package Oqtane.Blogs --version 6.2.0
Installing it as a package reference, rather than through the admin screens, means it is included in every publish, so a deployment can never remove it.
Note: the Blog module only works with SQL Server databases. It is disabled on SQLite, MySQL and PostgreSQL, which is one more reason this project uses SQL Server both locally and in production. Version 6.2.0 targets Oqtane 6.2, and it installed and ran on Oqtane 11 without changes.

Log in as host, open the Control Panel (gear icon), then Admin Dashboard, then Module Management, and the Blog module is listed as enabled.
Making It Keith's Site
Keith already had a one-page site, so I ported its look into a BlazorKit theme and its content into a site template. A site template is a C# class that Oqtane runs during installation to create the pages and their starting content, so the local database and the production database get exactly the same site.
| Page | Content |
|---|---|
| Home | Hero with his photo and tagline, "As seen on" strip |
| About | Biography and credits |
| Book Keith | Stand-up, corporate events, speaking, hosting |
| The Show | His 20/20/20 stand-up show and press quotes |
| Appearances | The Oqtane Blog module |
| Connect | Instagram and Threads |
The theme lives in Client/Themes/KmaTheme (a ThemeInfo.cs, a Default.razor layout and two containers) with its CSS and images in Server/wwwroot/Themes/KeithMichaelAshton.KmaTheme. The layout keeps Oqtane's <Login />, <ControlPanel /> and <Pane> components so editing still works.
Tip: Oqtane's admin screens use Bootstrap, so the theme still loads Bootstrap, and every custom CSS class is prefixed with k- so it never collides with it.
The site template is Server/SiteTemplate/KmaSiteTemplate.cs, and appsettings.json points the installation to it:
"SiteTemplate": "KeithMichaelAshton.SiteTemplate.KmaSiteTemplate, KeithMichaelAshton.Server.Oqtane"

After resetting the local database (docker volume rm kma-sql-data) and running aspire run again, the site installs with Keith's pages and look.
Editing The Site
This is the part that matters to Keith.

After logging in, he clicks the pencil button to switch on edit mode, then Edit Content on any block of text.

The rich text editor shows the content the way it looks on the page. He makes his change and clicks Save. Oqtane keeps every version, so the Versions tab can restore an earlier one.

To post an appearance, he goes to Appearances, switches on edit mode and clicks Add Blog. He enters a title, a short summary and the details, sets Published? to Yes and clicks Save. A Publish Date schedules a post for later, and Tags group appearances.

The appearance is live as soon as it is saved.
Deploy To Azure
The site deploys to an App Service that already exists, and it uses a database on an existing SQL Server. Aspire 17 can provision Azure resources itself, but it creates new Linux container sites rather than deploying to an existing Windows App Service, so here Aspire is used only for local development and the Server project is published on its own.
Configure The App Service
Important: configure the App Service before the first deployment. If BlazorKit starts without a connection string it shows its installation wizard, and on a public URL anyone who finds it first can install the site.
In the Azure portal, open the web app, then Settings, then Configuration, and on General settings set Web sockets to On. Oqtane's admin screens use Blazor Server, which needs WebSockets. Always on and ARR affinity should also be On.
Then open Settings, then Environment variables.
On the Connection strings tab, add a connection string named exactly DefaultConnection with the type SQLServer:
Data Source=<server>;Initial Catalog=<database>;User ID=<login>;Password=<password>;Encrypt=True;TrustServerCertificate=True;Connect Timeout=30
Note: I started with Encrypt=False, which encrypts only the login, so every query and result crosses the internet in clear text. Encrypt=True;TrustServerCertificate=True encrypts everything and works with a SQL Server that has no trusted certificate.
Tip: the name must be DefaultConnection. My first attempt was saved as SQLServer (the type), and BlazorKit would have ignored it.
On the App settings tab, add the same three unattended-install values the AppHost passes locally:
| Name | Value |
|---|---|
| Installation__DefaultAlias | Your domain and the app's azurewebsites.net host, comma separated |
| Installation__HostEmail | Your email address |
| Installation__HostPassword | A password with upper and lower case, a digit and a symbol |
Important: if the host password does not meet Oqtane's password rules, the installation still succeeds but no host account is created and nobody can log in.
App Service turns the connection string into the environment variable SQLCONNSTR_DefaultConnection, and .NET reads it as ConnectionStrings:DefaultConnection, so nothing secret is ever in appsettings.json or in source control. Also make sure the SQL Server's firewall allows the App Service's outbound IP addresses on port 1433; they are listed under Settings, then Properties, then Outbound IP addresses.
Publish
We publish only the Server project:
dotnet publish Server\KeithMichaelAshton.Server.csproj -c Release -r win-x64 --self-contained false -o artifacts\publish
Compress-Archive -Path artifacts\publish\* -DestinationPath artifacts\app.zip -Force
az webapp deploy -g <resource-group> -n <app-name> --src-path artifacts\app.zip --type zip --clean true
The first deployment uses --clean true to remove whatever was on the site before. Every later deployment uses --clean false, because the images Keith uploads are stored in Content folders on the server and are not part of the published files. A cleaning deployment would delete them.
Tip: you can also right-click the Server project in Visual Studio and choose Publish, then Azure, then Azure App Service (Windows), and select the existing app. Uncheck Remove additional files at destination after the first deployment, and do not use Run from package, because Oqtane writes to its folders at runtime.

On its first start the site installed itself against the production database, using the same site template, so it came up with all of Keith's pages. The azurewebsites.net address redirects to the custom domain, because the first alias is the default.
After The First Start
- Restart the app once. On the very first start, Oqtane logged a duplicate key error for its scheduled jobs (PurgeJob, NotificationJob) every minute. A single restart cleared it.
- Log in as host to make sure the account exists.
- Delete Installation__HostPassword from the App Service settings. It is only used for the first installation.
- In the Admin Dashboard, open User Management, add a user for the site owner and give them the Administrators role. They can edit everything on the site without being able to change system settings.
Performing Updates
- Make the change, test it with
aspire run, then publish the Server project again with Remove additional files at destination turned off, so the images Keith uploaded (in the Content folders) are kept. - Keith's pages, appearances and uploaded files live in the database and the Content folders, so a code update never touches his content.
- Make Oqtane host settings in appsettings.json in source control, not in Admin > System Info, because every publish replaces that file.
