@@ -956,6 +956,88 @@ logger.LogInformation("Database timeout: {Timeout}s",
956
956
957
957
---
958
958
959
+ # .NET Aspire
960
+
961
+ ---
962
+
963
+ # .NET Aspire Configuration
964
+
965
+ ## Cloud-Native Configuration Made Simple
966
+
967
+ - ** Orchestration** : Centralized service management through AppHost
968
+ - ** Service Defaults** : Opinionated baseline for observability, health checks, and service discovery
969
+ - ** Configuration Layering** : Hierarchical configuration across distributed services
970
+ - ** Modern Patterns** : Built-in support for microservices and cloud-native apps
971
+
972
+ ---
973
+
974
+ # Aspire Configuration Architecture
975
+
976
+ <div class =" columns " >
977
+ <div >
978
+
979
+ ## AppHost Project
980
+
981
+ ``` csharp
982
+ var builder = DistributedApplication .CreateBuilder (args );
983
+
984
+ var apiService = builder .AddProject <Projects .ApiService >(" apiservice" );
985
+
986
+ var workerService = builder .AddProject <Projects .WorkerService >(" workerservice" )
987
+ .WithEnvironment (" Api:BaseUrl" , apiService .GetEndpoint (" https" ));
988
+
989
+ builder .Build ().Run ();
990
+ ```
991
+
992
+ </div >
993
+ <div >
994
+
995
+ ## Service Defaults
996
+
997
+ ``` csharp
998
+ public static class Extensions
999
+ {
1000
+ public static IHostApplicationBuilder AddServiceDefaults (this IHostApplicationBuilder builder )
1001
+ {
1002
+ builder .ConfigureOpenTelemetry ();
1003
+ builder .AddDefaultHealthChecks ();
1004
+ builder .Services .AddServiceDiscovery ();
1005
+
1006
+ builder .Services .ConfigureHttpClientDefaults (http =>
1007
+ {
1008
+ http .AddStandardResilienceHandler ();
1009
+ http .UseServiceDiscovery ();
1010
+ });
1011
+
1012
+ return builder ;
1013
+ }
1014
+ }
1015
+ ```
1016
+
1017
+ </div >
1018
+ </div >
1019
+
1020
+ ---
1021
+
1022
+ # Aspire Configuration Layering
1023
+
1024
+ ## Configuration Priority (Last Wins)
1025
+
1026
+ 1 . ** SharedConfig** ` appsettings.json ` - Cross-service shared settings
1027
+ 2 . ** Service-specific** ` appsettings.json ` - Per-service configuration
1028
+ 3 . ** Environment-specific** ` appsettings.{Environment}.json `
1029
+ 4 . ** User Secrets** (Development only)
1030
+ 5 . ** AppHost Environment Variables** - ` WithEnvironment() ` calls
1031
+ 6 . ** Command Line Parameters** - Runtime overrides
1032
+
1033
+ ``` csharp
1034
+ // AppHost parameter injection
1035
+ var apiService = builder .AddProject <Projects .ApiService >(" apiservice" )
1036
+ .WithEnvironment (" Api:InjectedMessage" , builder .AddParameter (" ApiBaseMessage" ));
1037
+ ```
1038
+
1039
+ ---
1040
+
959
1041
# Questions?
960
1042
961
1043
---
@@ -972,6 +1054,7 @@ logger.LogInformation("Database timeout: {Timeout}s",
972
1054
### Docs
973
1055
974
1056
- [ .NET Configuration Docs] ( https://learn.microsoft.com/en-us/dotnet/core/extensions/configuration )
1057
+ - [ .NET Aspire Docs] ( https://learn.microsoft.com/en-us/dotnet/aspire/ )
975
1058
976
1059
</div >
977
1060
0 commit comments