Skip to content

.NET Aspire release 9.4 content #3926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 85 commits into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
020e105
Docs placeholders for 9.4
IEvangelist Jul 3, 2025
5319422
Add .NET Aspire 9.4 documentation, including breaking changes and upd…
IEvangelist Jul 4, 2025
4f1e11d
Add documentation for deprecating known parameters in AzureBicepResou…
IEvangelist Jul 4, 2025
33ca133
Fixes #3670
IEvangelist Jul 8, 2025
93ff3d3
Fixes #3930
IEvangelist Jul 8, 2025
24f41b3
Fix xref issues
IEvangelist Jul 8, 2025
744fbe0
Update documentation for GetSecretOutput method signature in deprecat…
IEvangelist Jul 8, 2025
69a4e21
Add the ASPIRE_VERSION_CHECK_DISABLED value to the App Host configura…
alistairmatthews Jul 10, 2025
cdf6266
Update .NET Aspire 9.4 release notes
IEvangelist Jul 10, 2025
e6941a3
Update eventing documentation and code samples for .NET Aspire 9.4 (#…
IEvangelist Jul 10, 2025
616aa67
Add details about Aspire 9.4 support of .NET 10 Preview 5. (#4040)
IEvangelist Jul 11, 2025
4f8368b
Add breaking change documentation for AddAzureOpenAI role defaulting …
IEvangelist Jul 11, 2025
8d34f89
Add details about how container networks are managed (#4041)
IEvangelist Jul 11, 2025
f05fc5a
dotnet-aspire-9.4.md: Add instructions to get aspire-cli (#4103)
radical Jul 18, 2025
ff1e288
Add tabs to CLI install
IEvangelist Jul 18, 2025
9b1c312
Initial update to simplify overview (#3904)
IEvangelist Jul 18, 2025
09d6165
Revisit overview
IEvangelist Jul 21, 2025
5b3c96f
Added a few bits about the dev dashboard
IEvangelist Jul 21, 2025
9e19914
Initial bits for the interaction service (#4045)
IEvangelist Jul 22, 2025
f6b2a73
Merge branch 'main' into release-9.4
IEvangelist Jul 22, 2025
bf69f59
Adds diaganostics content for ASPIRE008. Fixes #4106
IEvangelist Jul 22, 2025
a14af6d
Add details about interaction service in Local provisioning. Fixes #4046
IEvangelist Jul 22, 2025
cf7d3f7
Add back suppression content that was intended to be moved, but never…
IEvangelist Jul 22, 2025
3f8078d
Initial drafts of .NET Aspire CLI docs (#3905)
adegeo Jul 22, 2025
9bd32e9
Fix typo in AppHost.MessageBoxExample.cs (#4136)
sebastienros Jul 22, 2025
28c4eca
Create an include for the Aspire CLI install, and use new AKA links
IEvangelist Jul 22, 2025
f7d688f
Add GitHub Models integration, and fix headings in other integrations…
IEvangelist Jul 22, 2025
65ffebc
A bit of clean up
IEvangelist Jul 22, 2025
c376a74
Fixes #3669, adds breaking changes content for Hybrid compute support…
IEvangelist Jul 22, 2025
e45ea85
Add Azure AI Foundry integration. Fixes #3865
IEvangelist Jul 22, 2025
372e78e
Update documentation for Azure integrations and adjust Bicep file pat…
IEvangelist Jul 22, 2025
df99a37
Add .aspire directory to .gitignore
IEvangelist Jul 22, 2025
bed4c7d
Remove obsolete Bicep module files for Azure resources
IEvangelist Jul 22, 2025
5595cf1
Documented the unresolved parameters UI in the dashboard. (#4149)
alistairmatthews Jul 24, 2025
184d92b
Update installation instructions for Aspire CLI; enhance script optio…
IEvangelist Jul 24, 2025
db699d4
Update documentation for aspire deploy command, installation instruct…
IEvangelist Jul 24, 2025
a8b2934
Update note in aspire deploy documentation to clarify command availab…
IEvangelist Jul 24, 2025
6de27c7
Clarify note on enabling the aspire deploy command in documentation
IEvangelist Jul 24, 2025
b352229
Update metadata date in aspire config documentation and add deploy co…
IEvangelist Jul 24, 2025
052b4cb
Remove expansion for .NET Aspire 9.3 in the table of contents
IEvangelist Jul 24, 2025
5b63509
Add container image building content (#4148)
IEvangelist Jul 25, 2025
d38134a
Update package references to version 9.4.0-preview.1.25373.10 across …
IEvangelist Jul 25, 2025
f3fc9c3
Merge branch 'main' into release-9.4
IEvangelist Jul 25, 2025
d492cbc
Fix casing for Projects.Api in container image build snippet
IEvangelist Jul 25, 2025
5070943
Update installation instructions and script options for Aspire CLI
IEvangelist Jul 25, 2025
2148d8e
Recreate Visual Studio solution file for container image build snippets
IEvangelist Jul 25, 2025
671bb6e
Update documentation for .NET Aspire 9.4 release, including enhanceme…
IEvangelist Jul 25, 2025
39debe5
Update headings for app model and CLI enhancements in .NET Aspire 9.4…
IEvangelist Jul 25, 2025
7dac7e4
Update orchestration documentation to include external service resour…
IEvangelist Jul 25, 2025
90517db
Remove outdated "What's new in .NET Aspire 9.4" documentation
IEvangelist Jul 25, 2025
11880ef
Add YARP integration documentation and update table of contents - fix…
IEvangelist Jul 25, 2025
b22515a
Update Azure AI Foundry and YARP integration documentation for clarit…
IEvangelist Jul 25, 2025
328d3d2
Update package references to stable versions
IEvangelist Jul 25, 2025
28f946a
Update dotnet-aspire-9.4.md
IEvangelist Jul 27, 2025
5b86976
Update dotnet-aspire-9.4.md
IEvangelist Jul 27, 2025
98da1c1
updating whats new with fowlers tool version
maddymontaquila Jul 28, 2025
eb7ee7d
the beginnings of 9.4 editing
maddymontaquila Jul 28, 2025
a715452
Finished CLI section
maddymontaquila Jul 28, 2025
5224a67
about halfway
maddymontaquila Jul 29, 2025
e97eb76
done through dashboard
maddymontaquila Jul 29, 2025
d9b0931
project templates section
maddymontaquila Jul 29, 2025
210c6c2
azure pt 1
maddymontaquila Jul 29, 2025
e49d35d
azure section
maddymontaquila Jul 29, 2025
f469aba
dashboard link to james's tweets
maddymontaquila Jul 29, 2025
6b53dbc
changing "aside" to "tip"
maddymontaquila Jul 29, 2025
4e2b43a
fixing markdown linter issues
maddymontaquila Jul 29, 2025
72187ba
trailing space
maddymontaquila Jul 29, 2025
2dab28a
Apply suggestions from Alistair's review
maddymontaquila Jul 29, 2025
0fd10d2
Apply missed suggestions from code review
maddymontaquila Jul 29, 2025
3e34f7a
dashboard media
maddymontaquila Jul 29, 2025
4067434
fixing dashboard img
maddymontaquila Jul 29, 2025
8511b2a
moving interaction service to top of app model section
maddymontaquila Jul 29, 2025
48aca08
editing sentence on dashboard reconnect mdoal
maddymontaquila Jul 29, 2025
108e46a
Eric's review
maddymontaquila Jul 29, 2025
ff2cbf4
OPS warnings
maddymontaquila Jul 29, 2025
0d7408f
trying to fix interaction serrvice deep links
maddymontaquila Jul 29, 2025
de09cf6
one last link
maddymontaquila Jul 29, 2025
4aac437
rerun jobs
maddymontaquila Jul 29, 2025
6ac3bcb
rerun jobs
maddymontaquila Jul 29, 2025
37d3f0b
azure preview versions
maddymontaquila Jul 29, 2025
b12b2c2
azure preview versions functions
maddymontaquila Jul 29, 2025
baa0529
fixing crefs
maddymontaquila Jul 29, 2025
60be7d6
fixing crefs
maddymontaquila Jul 29, 2025
77a5c0d
fixing crefs
maddymontaquila Jul 29, 2025
e484188
fixing crefs
maddymontaquila Jul 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/prompts/adhere-to-writing-style.prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Write for readers who may have a limited vocabulary or are not native English sp
- Use active voice
- Use the second person (you, your) to address the reader directly

## Lists

Use lists more sparingly. Use them only when they help to clarify the content. Use bullet points for unordered lists and numbered lists for ordered lists. Regardless of the type of list, always use sentence-style capitalization, complete sentences, and proper punctuation.

## Headings

Headings use sentence-style capitalization. Always capitalize the first word of a heading. Do not use gerunds (e.g., "Using" or "Creating") in heading.
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
syntax: glob

.aspire/
**/.aspire/

# Python virtual environments
.venv

Expand Down
1 change: 1 addition & 0 deletions docs/app-host/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ For more information, see [.NET Aspire and launch profiles](../fundamentals/laun
|--|--|--|
| `ASPIRE_ALLOW_UNSECURED_TRANSPORT` | `false` | Allows communication with the app host without https. `ASPNETCORE_URLS` (dashboard address) and `ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL` (app host resource service address) must be secured with HTTPS unless true. |
| `ASPIRE_CONTAINER_RUNTIME` | `docker` | Allows the user of alternative container runtimes for resources backed by containers. Possible values are `docker` (default) or `podman`. See [Setup and tooling overview for more details](../fundamentals/setup-tooling.md). |
| `ASPIRE_VERSION_CHECK_DISABLED` | `false` | When set to `true`, .NET Aspire doesn't check for newer versions on startup. |

## Resource service

Expand Down
37 changes: 22 additions & 15 deletions docs/app-host/eventing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Eventing in .NET Aspire
description: Learn how to use the .NET eventing features with .NET Aspire.
ms.date: 04/04/2025
ms.date: 07/10/2025
---

# Eventing in .NET Aspire
Expand All @@ -17,48 +17,55 @@ In this article, you learn how to use the eventing features in .NET Aspire.
The following events are available in the app host and occur in the following order:

1. <xref:Aspire.Hosting.ApplicationModel.BeforeStartEvent>: This event is raised before the app host starts.
1. <xref:Aspire.Hosting.ApplicationModel.AfterEndpointsAllocatedEvent>: This event is raised after the app host allocated endpoints.
1. <xref:Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent>: This event is raised per resource after its endpoints are allocated.
1. <xref:Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent>: This event is raised after the app host created resources.

All of the preceding events are analogous to the [app host life cycles](xref:dotnet/aspire/app-host#app-host-life-cycles). That is, an implementation of the <xref:Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook> could handle these events just the same. With the eventing API, however, you can run arbitrary code when these events are raised and event define custom events—any event that implements the <xref:Aspire.Hosting.Eventing.IDistributedApplicationEvent> interface.

### Subscribe to app host events

To subscribe to the built-in app host events, use the eventing API. After you have a distributed application builder instance, walk up to the <xref:Aspire.Hosting.IDistributedApplicationBuilder.Eventing?displayProperty=nameWithType> property and call the <xref:Aspire.Hosting.Eventing.IDistributedApplicationEventing.Subscribe``1(System.Func{``0,System.Threading.CancellationToken,System.Threading.Tasks.Task})> API. Consider the following sample app host _Program.cs_ file:
To subscribe to the built-in app host events, use the eventing API. After you have a distributed application builder instance, walk up to the <xref:Aspire.Hosting.IDistributedApplicationBuilder.Eventing?displayProperty=nameWithType> property and call the <xref:Aspire.Hosting.Eventing.IDistributedApplicationEventing.Subscribe``1(System.Func{``0,System.Threading.CancellationToken,System.Threading.Tasks.Task})> API. Consider the following sample app host _AppHost.cs_ file:

:::code source="snippets/AspireApp/AspireApp.AppHost/Program.cs":::
:::code source="snippets/AspireApp/AspireApp.AppHost/AppHost.cs":::

The preceding code is based on the starter template with the addition of the calls to the `Subscribe` API. The `Subscribe<T>` API returns a <xref:Aspire.Hosting.Eventing.DistributedApplicationEventSubscription> instance that you can use to unsubscribe from the event. It's common to discard the returned subscriptions, as you don't usually need to unsubscribe from events as the entire app is torn down when the app host is shut down.

When the app host is run, by the time the .NET Aspire dashboard is displayed, you should see the following log output in the console:

:::code language="Plaintext" source="snippets/AspireApp/AspireApp.AppHost/Console.txt" highlight="2,10-14,20":::
:::code language="Plaintext" source="snippets/AspireApp/AspireApp.AppHost/Console.txt" highlight="2,10,12,14,16,22":::

The log output confirms that event handlers are executed in the order of the app host life cycle events. The subscription order doesn't affect execution order. The `BeforeStartEvent` is triggered first, followed by `AfterEndpointsAllocatedEvent`, then each resource has its `ResourceEndpointsAllocatedEvent` event fired, and finally `AfterResourcesCreatedEvent`.
The log output confirms that event handlers are executed in the order of the app host life cycle events. The subscription order doesn't affect execution order. The `BeforeStartEvent` is triggered first, followed by each resource's `ResourceEndpointsAllocatedEvent`, and finally `AfterResourcesCreatedEvent`.

## Resource eventing

In addition to the app host events, you can also subscribe to resource events. Resource events are raised specific to an individual resource. Resource events are defined as implementations of the <xref:Aspire.Hosting.Eventing.IDistributedApplicationResourceEvent> interface. The following resource events are available in the listed order:

1. `InitializeResourceEvent`: Raised by orchestrators to signal to resources that they should initialize themselves.
1. <xref:Aspire.Hosting.ApplicationModel.InitializeResourceEvent>: Raised by orchestrators to signal to resources that they should initialize themselves.
1. <xref:Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent>: Raised when the orchestrator allocates endpoints for a resource.
1. <xref:Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent>: Raised when a connection string becomes available for a resource.
1. <xref:Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent>: Raised before the orchestrator starts a new resource.
1. <xref:Aspire.Hosting.ApplicationModel.ResourceReadyEvent>: Raised when a resource initially transitions to a ready state.

### Subscribe to resource events

To subscribe to resource events, use the eventing API. After you have a distributed application builder instance, walk up to the <xref:Aspire.Hosting.IDistributedApplicationBuilder.Eventing?displayProperty=nameWithType> property and call the <xref:Aspire.Hosting.Eventing.IDistributedApplicationEventing.Subscribe``1(Aspire.Hosting.ApplicationModel.IResource,System.Func{``0,System.Threading.CancellationToken,System.Threading.Tasks.Task})> API. Consider the following sample app host _Program.cs_ file:
To subscribe to resource events, use the convenience-based extension methods—`On*`. After you have a distributed application builder instance, and a resource builder, walk up to the instance and chain a call to the desired `On*` event API. Consider the following sample _AppHost.cs_ file:

:::code source="snippets/AspireApp/AspireApp.ResourceAppHost/Program.cs":::
:::code source="snippets/AspireApp/AspireApp.ResourceAppHost/AppHost.cs":::

The preceding code subscribes to the `InitializeResourceEvent`, `ResourceReadyEvent`, `ConnectionStringAvailableEvent`, and `BeforeResourceStartedEvent` events on the `cache` resource. When <xref:Aspire.Hosting.RedisBuilderExtensions.AddRedis*> is called, it returns an <xref:Aspire.Hosting.ApplicationModel.IResourceBuilder`1> where `T` is a <xref:Aspire.Hosting.ApplicationModel.RedisResource>. The resource builder exposes the resource as the <xref:Aspire.Hosting.ApplicationModel.IResourceBuilder`1.Resource?displayProperty=nameWithType> property. The resource in question is then passed to the `Subscribe` API to subscribe to the events on the resource.
The preceding code subscribes to the `InitializeResourceEvent`, `ResourceReadyEvent`, `ResourceEndpointsAllocatedEvent`, `ConnectionStringAvailableEvent`, and `BeforeResourceStartedEvent` events on the `cache` resource. When <xref:Aspire.Hosting.RedisBuilderExtensions.AddRedis*> is called, it returns an <xref:Aspire.Hosting.ApplicationModel.IResourceBuilder`1> where `T` is a <xref:Aspire.Hosting.ApplicationModel.RedisResource>. Chain calls to the `On*` methods to subscribe to the events. The `On*` methods return the same <xref:Aspire.Hosting.ApplicationModel.IResourceBuilder`1> instance, so you can chain multiple calls:

- `OnInitializeResource`: Subscribes to the <xref:Aspire.Hosting.ApplicationModel.InitializeResourceEvent>.
- `OnResourceEndpointsAllocated`: Subscribes to the <xref:Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent> event.
- `OnConnectionStringAvailable`: Subscribes to the <xref:Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent> event.
- `OnBeforeResourceStarted`: Subscribes to the <xref:Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent> event.
- `OnResourceReady`: Subscribes to the <xref:Aspire.Hosting.ApplicationModel.ResourceReadyEvent> event.

When the app host is run, by the time the .NET Aspire dashboard is displayed, you should see the following log output in the console:

:::code language="Plaintext" source="snippets/AspireApp/AspireApp.ResourceAppHost/Console.txt" highlight="8,10,12,18":::
:::code language="Plaintext" source="snippets/AspireApp/AspireApp.ResourceAppHost/Console.txt" highlight="8,10,12,14,20":::

> [!NOTE]
> Some events are blocking. For example, when the `BeforeResourceStartEvent` is published, the startup of the resource will be blocked until all subscriptions for that event on a given resource have completed executing. Whether an event is blocking or not depends on how it is published (see the following section).
> Some events block execution. For example, when the `BeforeResourceStartedEvent` is published, the resource startup blocks until all subscriptions for that event on a given resource finish executing. Whether an event blocks or not depends on how you publish it (see the following section).

## Publish events

Expand All @@ -74,15 +81,15 @@ Then, you can subscribe and publish the event by calling the either of the follo
When events are dispatched, you can control how the events are dispatched to subscribers. The event dispatch behavior is specified with the `EventDispatchBehavior` enum. The following behaviors are available:

- <xref:Aspire.Hosting.Eventing.EventDispatchBehavior.BlockingSequential?displayProperty=nameWithType>: Fires events sequentially and blocks until they're all processed.
- <xref:Aspire.Hosting.Eventing.EventDispatchBehavior.BlockingConcurrent?displayProperty=nameWithType>: Fires events concurrently and blocks until they are all processed.
- <xref:Aspire.Hosting.Eventing.EventDispatchBehavior.BlockingConcurrent?displayProperty=nameWithType>: Fires events concurrently and blocks until they're all processed.
- <xref:Aspire.Hosting.Eventing.EventDispatchBehavior.NonBlockingSequential?displayProperty=nameWithType>: Fires events sequentially but doesn't block.
- <xref:Aspire.Hosting.Eventing.EventDispatchBehavior.NonBlockingConcurrent?displayProperty=nameWithType>: Fires events concurrently but doesn't block.

The default behavior is `EventDispatchBehavior.BlockingSequential`. To override this behavior, when calling a publishing API such as <xref:Aspire.Hosting.Eventing.IDistributedApplicationEventing.PublishAsync*>, provide the desired behavior as an argument.

## App Host life cycle events

As you have seen, eventing is the most flexible approach. However, in this section you learn about the alternative: life cycle events.
Eventing offers the most flexibility. However, this section explains the alternative: life cycle events.

The .NET Aspire app host exposes several life cycles that you can hook into by implementing the <xref:Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook> interface. The following lifecycle methods are available:

Expand All @@ -96,7 +103,7 @@ The .NET Aspire app host exposes several life cycles that you can hook into by i

To register a life cycle hook, implement the <xref:Aspire.Hosting.Lifecycle.IDistributedApplicationLifecycleHook> interface and register the hook with the app host using the <xref:Aspire.Hosting.Lifecycle.LifecycleHookServiceCollectionExtensions.AddLifecycleHook*> API:

:::code source="../fundamentals/snippets/lifecycles/AspireApp/AspireApp.AppHost/Program.cs":::
:::code source="../fundamentals/snippets/lifecycles/AspireApp/AspireApp.AppHost/AppHost.cs":::

The preceding code:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,21 @@
.WaitFor(apiService);

builder.Eventing.Subscribe<ResourceEndpointsAllocatedEvent>(
(@event, cancellationToken) =>
{
// The event doesn't expose an IServiceProvider, just write to the console.
Console.WriteLine($"""
3. '{@event.Resource.Name}' ResourceEndpointsAllocatedEvent
""");

return Task.CompletedTask;
});

builder.Eventing.Subscribe<BeforeStartEvent>(
static (@event, cancellationToken) =>
{
var logger = @event.Services.GetRequiredService<ILogger<Program>>();

logger.LogInformation("1. BeforeStartEvent");
logger.LogInformation("2. \"{ResourceName}\" ResourceEndpointsAllocatedEvent", @event.Resource.Name);

return Task.CompletedTask;
});

builder.Eventing.Subscribe<AfterEndpointsAllocatedEvent>(
builder.Eventing.Subscribe<BeforeStartEvent>(
static (@event, cancellationToken) =>
{
var logger = @event.Services.GetRequiredService<ILogger<Program>>();

logger.LogInformation("2. AfterEndpointsAllocatedEvent");
logger.LogInformation("1. BeforeStartEvent");

return Task.CompletedTask;
});
Expand All @@ -50,7 +39,7 @@
{
var logger = @event.Services.GetRequiredService<ILogger<Program>>();

logger.LogInformation("4. AfterResourcesCreatedEvent");
logger.LogInformation("3. AfterResourcesCreatedEvent");

return Task.CompletedTask;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="Aspire.AppHost.Sdk" Version="9.2.0" />
<Sdk Name="Aspire.AppHost.Sdk" Version="9.4.0" />

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -16,8 +16,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.3.1" />
<PackageReference Include="Aspire.Hosting.Redis" Version="9.3.1" />
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.4.0" />
<PackageReference Include="Aspire.Hosting.Redis" Version="9.4.0" />
</ItemGroup>

</Project>
16 changes: 9 additions & 7 deletions docs/app-host/snippets/AspireApp/AspireApp.AppHost/Console.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
info: Program[0]
1. BeforeStartEvent
info: Aspire.Hosting.DistributedApplication[0]
Aspire version: 9.3.0-preview.1.25262.2+6d54dc081cd2e7ea435e33f7c0e62ff6946ae66d
Aspire version: 9.4.0
info: Aspire.Hosting.DistributedApplication[0]
Distributed application starting.
info: Aspire.Hosting.DistributedApplication[0]
Application host directory is: ../AspireApp/AspireApp.AppHost
info: Program[0]
2. AfterEndpointsAllocatedEvent
3. 'aspire-dashboard' ResourceEndpointsAllocatedEvent
3. 'cache' ResourceEndpointsAllocatedEvent
3. 'apiservice' ResourceEndpointsAllocatedEvent
3. 'webfrontend' ResourceEndpointsAllocatedEvent
2. "cache" ResourceEndpointsAllocatedEvent
info: Program[0]
2. "apiservice" ResourceEndpointsAllocatedEvent
info: Program[0]
2. "webfrontend" ResourceEndpointsAllocatedEvent
info: Program[0]
2. "aspire-dashboard" ResourceEndpointsAllocatedEvent
info: Aspire.Hosting.DistributedApplication[0]
Now listening on: https://localhost:17178
info: Aspire.Hosting.DistributedApplication[0]
Login to the dashboard at https://localhost:17178/login?t=<YOUR_TOKEN>
info: Program[0]
4. AfterResourcesCreatedEvent
3. AfterResourcesCreatedEvent
info: Aspire.Hosting.DistributedApplication[0]
Distributed application started. Press Ctrl+C to shut down.
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,52 @@

var cache = builder.AddRedis("cache");

builder.Eventing.Subscribe<ResourceReadyEvent>(
cache.Resource,
static (@event, cancellationToken) =>
cache.OnResourceReady(static (resource, @event, cancellationToken) =>
{
var logger = @event.Services.GetRequiredService<ILogger<Program>>();

logger.LogInformation("4. ResourceReadyEvent");
logger.LogInformation("5. OnResourceReady");

return Task.CompletedTask;
});

builder.Eventing.Subscribe<InitializeResourceEvent>(cache.Resource,
static (@event, cancellationToken) =>
cache.OnInitializeResource(
static (resource, @event, cancellationToken) =>
{
var logger = @event.Services.GetRequiredService<ILogger<Program>>();

logger.LogInformation("1. InitializeResourceEvent");
logger.LogInformation("1. OnInitializeResource");

return Task.CompletedTask;
});

builder.Eventing.Subscribe<BeforeResourceStartedEvent>(
cache.Resource,
static (@event, cancellationToken) =>
cache.OnBeforeResourceStarted(
static (resource, @event, cancellationToken) =>
{
var logger = @event.Services.GetRequiredService<ILogger<Program>>();

logger.LogInformation("3. BeforeResourceStartedEvent");
logger.LogInformation("4. OnBeforeResourceStarted");


return Task.CompletedTask;
});

cache.OnResourceEndpointsAllocated(
static (resource, @event, cancellationToken) =>
{
var logger = @event.Services.GetRequiredService<ILogger<Program>>();

logger.LogInformation("2. OnResourceEndpointsAllocated");

return Task.CompletedTask;
});

builder.Eventing.Subscribe<ConnectionStringAvailableEvent>(
cache.Resource,
static (@event, cancellationToken) =>
cache.OnConnectionStringAvailable(
static (resource, @event, cancellationToken) =>
{
var logger = @event.Services.GetRequiredService<ILogger<Program>>();

logger.LogInformation("2. ConnectionStringAvailableEvent");
logger.LogInformation("3. OnConnectionStringAvailable");

return Task.CompletedTask;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="Aspire.AppHost.Sdk" Version="9.2.0" />
<Sdk Name="Aspire.AppHost.Sdk" Version="9.4.0" />

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -16,8 +16,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.3.1" />
<PackageReference Include="Aspire.Hosting.Redis" Version="9.3.1" />
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.4.0" />
<PackageReference Include="Aspire.Hosting.Redis" Version="9.4.0" />
</ItemGroup>

</Project>
Loading
Loading