Dotnetconf2024-Simplify The Development of Distributed Applications With .NET Aspire
Dotnetconf2024-Simplify The Development of Distributed Applications With .NET Aspire
01 02 03
.NET Aspire What’s new in .NET Intelligent Apps
Aspire 9? with .NET Aspire
01
.NET Aspire
Every App Needs
Enrichment
Redaction
Integrations Deployment
A cloud ready stack for building observable,
production ready, distributed applications
Integrations Deployment
.NET Aspire Service Defaults
Clone: https://github.com/thangchung/practical-dotnet-aspire
A cloud ready stack for building observable,
production ready, distributed applications
Integrations Deployment
.NET Aspire
Developer Dashboard
Structured Logs
Metrics
Distributed Traces
Dependencies
Integrating the Developer Dashboard
Integrations Deployment
Orchestration Before
.NET Aspire
Orchestration
builder.AddProject<Projects.ApiService>("apiservice");
builder.AddProject<Projects.Web>("webfrontend");
builder.Build().Run();
After with .NET Aspire
DEMO
Clone: https://github.com/thangchung/practical-dotnet-aspire
A cloud ready stack for building observable,
production ready, distributed applications
Integrations Deployment
Service Discovery Before
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ProductEndpoint": "http://localhost:5228",
"ProductEndpointHttps": "https://localhost:7130"
}
builder.Services.AddHttpClient<ProductService>(c =>
{
var url = builder.Configuration["ProductEndpoint"] ?? throw new
InvalidOperationException("ProductEndpoint is not set");
c.BaseAddress = new(url);
});
Service Discovery
var builder = DistributedApplication.CreateBuilder(args);
builder.AddProject<Projects.Web>("webfrontend")
.WithReference(apiService);
builder.Build().Run();
builder.Services.AddHttpClient<WeatherApiClient>(client =>
{
client.BaseAddress = new("https+http://apiservice");
});
There are still connection strings
DEMO
Clone: https://github.com/thangchung/practical-dotnet-aspire
A cloud ready stack for building observable,
production ready, distributed applications
Integrations Deployment
.NET Aspire
https://www.nuget.org
.NET Aspire Automatically will pull
down container
image and start it in
Docker or Podman!
Hosting Integration
var builder = DistributedApplication.CreateBuilder(args);
builder.AddProject<Projects.Web>("webfrontend")
.WithReference(apiService)
.WithReference(cache);
builder.Build().Run();
.NET Aspire
Client Integration
var builder = WebApplication.CreateBuilder(args);
app.UseOutputCache();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
app.MapDefaultEndpoints();
app.Run();
DEMO
Clone: https://github.com/thangchung/practical-dotnet-aspire
A cloud ready stack for building observable,
production ready, distributed applications
Integrations Deployment
Flexible Integrations & Deployment
My support enquiries
Tickets Staff
Classification
23244 … … … OK
…
23243 … … …
Sentiment score
23190 … … … …
Staff web UI
Q&A
Classification Semantic search (RAG)
Ticket 23419 Staff
Clone: https://github.com/thangchung/practical-dotnet-aspire
That’s enough for today…
Get .NET 9
Download .NET 9
aka.ms/get-dotnet-9
More on
https://learn.microsoft.com/en-
us/dotnet/aspire/whats-new/dotnet-aspire-
9
.NET Aspire
aka.ms/letslearn/dotnet/aspire aka.ms/aspire/videos
aka.ms/dotnet-aspire github.com/dotnet/aspire