Blazor WASM Hosting Not Loading Web Assets
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 201
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
When I try to wire up a Blazor WASM project and run it, the link from the Aspire dashboard shows the "unhandled error occured" with no styling
### Expected Behavior
For the Blazor WASM site to load properly
### Steps To Reproduce
```bash
mkdir aspireblazor
cd aspireblazor
dotnet new aspire
dotnet new blazorwasm -n blazorwasm
dotnet add .\blazoraspire.AppHost.csproj reference ..\blazorwasm\blazorwasm.csproj
aspire add blazor
```
Update `AppHost.cs`
```csharp
using Projects;
var builder = DistributedApplication.CreateBuilder(args);
//This does not work either
//var blazorApp = builder.AddBlazorWasmApp("app","../blazorwasm/blazorwasm.csproj");
var blazorApp = builder.AddBlazorWasmProject("app");
var gateway = builder.AddBlazorGateway("gateway")
.WithExternalHttpEndpoints()
.WithBlazorClientApp(blazorApp);
builder.Build().Run();
```
### Exceptions (if any)
_No response_
### Aspire doctor output
```
aspire doctor
Aspire Environment Check
========================
Aspire
✅ Aspire CLI version 13.4.6 (channel: stable)
AppHost
✅ AppHost version 13.4.6 (blazoraspire.AppHost.csproj)
.NET SDK
✅ .NET 11.0.100-preview.6.26359.118 installed (x64)
Container Runtime
✅ Docker v29.6.2: running (auto-detected (default)) ← active
Environment
✅ HTTPS development certificate is trusted
Summary: 5 passed, 0 warnings, 0 failed
Aspire CLI Installations
========================
╭───────────────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────┬──────────────┬──────────────┬─────────────╮
│ Path │ Version │ Channel │ Route │ PATH status │
├───────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────┼──────────────┼──────────────┼─────────────┤
│ C:\Users\isaac\.dotnet\tools\.store\aspire.cli\13.4.6\aspire.cli.win-x64\13.4.6\tools │ 13.4.6+87fe259e4fc244c599019a7b1304c85a1488f248 │ stable │ dotnet-tool │ not on PATH │
│ \net10.0\win-x64\aspire.exe (current) │ │ │ │ │
│ C:\Users\isaac\.dotnet\tools\aspire.CMD │ (not probed) │ (not probed) │ (not probed) │ active
```
### Anything else?
Here is a recording of the issue
Contributor guide
Research direction
Start by reproducing the setup with the listed dotnet and aspire commands, then inspect AppHost.cs and the Blazor WASM hosting path used by AddBlazorWasmProject and WithBlazorClientApp. Done means the dashboard link loads the Blazor WASM site without the unhandled-error page and its web assets, including styling, are served correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, wasm
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100