Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ This updates your `aspire.config.json` with the Blazor hosting package:

## Add Blazor WebAssembly project

Use `AddBlazorWasmProject` / `addBlazorWasmProject` to add a Blazor WebAssembly project to the AppHost model.
Use <ApiReference name="Aspire.Hosting.BlazorGatewayExtensions.AddBlazorWasmProject" /> to add a Blazor WebAssembly project to the AppHost model.

<Tabs syncKey='aspire-lang'>
<TabItem id='csharp' label='C#'>
Expand Down Expand Up @@ -114,7 +114,7 @@ await builder.build().run();

## Add Blazor Gateway

Use `AddBlazorGateway` / `addBlazorGateway` to add the Blazor Gateway resource. The gateway is the browser-facing endpoint for your hosted Blazor app.
Use <ApiReference name="Aspire.Hosting.BlazorGatewayExtensions.AddBlazorGateway" /> to add the Blazor Gateway resource. The gateway is the browser-facing endpoint for your hosted Blazor app.

<Tabs syncKey='aspire-lang'>
<TabItem id='csharp' label='C#'>
Expand Down Expand Up @@ -147,12 +147,12 @@ await builder.build().run();
</Tabs>

:::note
`WithExternalHttpEndpoints()` / `withExternalHttpEndpoints()` marks the gateway endpoint as externally accessible so browser traffic can reach your app.
<ApiReference name="Aspire.Hosting.ResourceBuilderExtensions.WithExternalHttpEndpoints" /> marks the gateway endpoint as externally accessible so browser traffic can reach your app.
:::

## Associate a client app with the gateway

Use `WithBlazorClientApp` / `withBlazorClientApp` to bind the WebAssembly project resource to the Blazor Gateway:
Use <ApiReference name="Aspire.Hosting.BlazorGatewayExtensions.WithBlazorClientApp" parameterTypes={['Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ProjectResource>', 'Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.BlazorWasmAppResource>', 'string', 'string', 'bool']} /> to bind the WebAssembly project resource to the Blazor Gateway:

<Tabs syncKey='aspire-lang'>
<TabItem id='csharp' label='C#'>
Expand Down Expand Up @@ -225,6 +225,7 @@ const client = await builder.addBlazorWasmProject(
);
const gateway = await builder.addDotnetProjectBlazorGateway('gateway');

await gateway.withExternalHttpEndpoints();
await gateway.withBlazorClientApp(client);

await builder.build().run();
Expand All @@ -242,6 +243,7 @@ var builder = DistributedApplication.CreateBuilder(args);
var client = builder.AddBlazorWasmProject<Projects.Client>("client");

builder.AddDotnetProjectBlazorGateway("gateway")
.WithExternalHttpEndpoints()
.WithBlazorClientApp(client);

builder.Build().Run();
Expand All @@ -254,7 +256,8 @@ builder.Build().Run();
`AddDotnetProjectBlazorGateway` and its `WithBlazorClientApp` overload
carry `ASPIREDOTNETPROJECT001`, in addition to the
Blazor integration's `ASPIREBLAZOR001` diagnostic. These gateway APIs are
experimental independently of the core Dotnet project APIs.
experimental independently of the core Dotnet project APIs. This gateway
runs as a file-based C# app and supports both `aspire run` and publishing.
For details on suppressing the diagnostic, see
[ASPIREDOTNETPROJECT001](/diagnostics/aspiredotnetproject001/).
</Aside>
Expand Down
Loading