Skip to content
Docs Try Aspire
Docs Try

BlazorGatewayExtensions

Class static net8.0
📦 Aspire.Hosting.Blazor v13.4.0-preview.1.26281.18
Extension methods for adding Blazor WebAssembly apps and gateway resources.
namespace Aspire.Hosting;
public static class BlazorGatewayExtensions
{
// ...
}
AddBlazorGateway(IDistributedApplicationBuilder, string)extensionats export
IResourceBuilder<ProjectResource>
Registers the built-in Blazor Gateway as a file-based C# app. The gateway is shipped as Gateway.cs alongside this library and launched via AddCSharpApp. No separate project is needed.
AddBlazorWasmApp(IDistributedApplicationBuilder, string, string)extensionats export
IResourceBuilder<BlazorWasmAppResource>
Registers a Blazor WebAssembly project as a resource without launching it as a process. Prefer AddBlazorWasmProject<TProject> which uses IProjectMetadata for path discovery.
AddBlazorWasmProject(IDistributedApplicationBuilder, string)extensionats ignored
IResourceBuilder<BlazorWasmAppResource>
Registers a Blazor WebAssembly project as a resource using the Aspire-generated IProjectMetadata type to discover the project path. The resource name becomes the URL path prefix (e.g., "store" → served at /store/). Use WithReference() to declare service dependencies.
WithBlazorClientApp(IResourceBuilder<ProjectResource>, IResourceBuilder<BlazorWasmAppResource>, string, string, bool)extensionats export
IResourceBuilder<ProjectResource>
Attaches a Blazor WebAssembly app to the Gateway. The resource name is used as the URL path prefix (e.g., resource "store" → /store/). Service names are derived from WithReference() annotations on the WASM resource. Service references from the WASM app are automatically forwarded to the gateway so the gateway can resolve service endpoints for YARP proxying.
View all methods