diff --git a/src/AntSK.AppHost/AntSK.AppHost.csproj b/src/AntSK.AppHost/AntSK.AppHost.csproj
new file mode 100644
index 0000000..0c428d8
--- /dev/null
+++ b/src/AntSK.AppHost/AntSK.AppHost.csproj
@@ -0,0 +1,20 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+ true
+ 32ac67c8-178a-4eeb-871d-879023582e06
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/AntSK.AppHost/Program.cs b/src/AntSK.AppHost/Program.cs
new file mode 100644
index 0000000..0b13ec1
--- /dev/null
+++ b/src/AntSK.AppHost/Program.cs
@@ -0,0 +1,5 @@
+var builder = DistributedApplication.CreateBuilder(args);
+
+builder.AddProject("antsk");
+
+builder.Build().Run();
diff --git a/src/AntSK.AppHost/appsettings.Development.json b/src/AntSK.AppHost/appsettings.Development.json
new file mode 100644
index 0000000..0c208ae
--- /dev/null
+++ b/src/AntSK.AppHost/appsettings.Development.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ }
+}
diff --git a/src/AntSK.AppHost/appsettings.json b/src/AntSK.AppHost/appsettings.json
new file mode 100644
index 0000000..31c092a
--- /dev/null
+++ b/src/AntSK.AppHost/appsettings.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning",
+ "Aspire.Hosting.Dcp": "Warning"
+ }
+ }
+}
diff --git a/src/AntSK.ServiceDefaults/AntSK.ServiceDefaults.csproj b/src/AntSK.ServiceDefaults/AntSK.ServiceDefaults.csproj
new file mode 100644
index 0000000..589e391
--- /dev/null
+++ b/src/AntSK.ServiceDefaults/AntSK.ServiceDefaults.csproj
@@ -0,0 +1,22 @@
+
+
+
+ net8.0
+ enable
+ enable
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/AntSK.ServiceDefaults/Extensions.cs b/src/AntSK.ServiceDefaults/Extensions.cs
new file mode 100644
index 0000000..2a3f4e0
--- /dev/null
+++ b/src/AntSK.ServiceDefaults/Extensions.cs
@@ -0,0 +1,118 @@
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Diagnostics.HealthChecks;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Diagnostics.HealthChecks;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.ServiceDiscovery;
+using OpenTelemetry;
+using OpenTelemetry.Metrics;
+using OpenTelemetry.Trace;
+
+namespace Microsoft.Extensions.Hosting;
+
+// Adds common .NET Aspire services: service discovery, resilience, health checks, and OpenTelemetry.
+// This project should be referenced by each service project in your solution.
+// To learn more about using this project, see https://aka.ms/dotnet/aspire/service-defaults
+public static class Extensions
+{
+ public static IHostApplicationBuilder AddServiceDefaults(this IHostApplicationBuilder builder)
+ {
+ builder.ConfigureOpenTelemetry();
+
+ builder.AddDefaultHealthChecks();
+
+ builder.Services.AddServiceDiscovery();
+
+ builder.Services.ConfigureHttpClientDefaults(http =>
+ {
+ // Turn on resilience by default
+ http.AddStandardResilienceHandler();
+
+ // Turn on service discovery by default
+ http.AddServiceDiscovery();
+ });
+
+ // Uncomment the following to restrict the allowed schemes for service discovery.
+ // builder.Services.Configure(options =>
+ // {
+ // options.AllowedSchemes = ["https"];
+ // });
+
+ return builder;
+ }
+
+ public static IHostApplicationBuilder ConfigureOpenTelemetry(this IHostApplicationBuilder builder)
+ {
+ builder.Logging.AddOpenTelemetry(logging =>
+ {
+ logging.IncludeFormattedMessage = true;
+ logging.IncludeScopes = true;
+ });
+
+ builder.Services.AddOpenTelemetry()
+ .WithMetrics(metrics =>
+ {
+ metrics.AddAspNetCoreInstrumentation()
+ .AddHttpClientInstrumentation()
+ .AddRuntimeInstrumentation();
+ })
+ .WithTracing(tracing =>
+ {
+ tracing.AddAspNetCoreInstrumentation()
+ // Uncomment the following line to enable gRPC instrumentation (requires the OpenTelemetry.Instrumentation.GrpcNetClient package)
+ //.AddGrpcClientInstrumentation()
+ .AddHttpClientInstrumentation();
+ });
+
+ builder.AddOpenTelemetryExporters();
+
+ return builder;
+ }
+
+ private static IHostApplicationBuilder AddOpenTelemetryExporters(this IHostApplicationBuilder builder)
+ {
+ var useOtlpExporter = !string.IsNullOrWhiteSpace(builder.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"]);
+
+ if (useOtlpExporter)
+ {
+ builder.Services.AddOpenTelemetry().UseOtlpExporter();
+ }
+
+ // Uncomment the following lines to enable the Azure Monitor exporter (requires the Azure.Monitor.OpenTelemetry.AspNetCore package)
+ //if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
+ //{
+ // builder.Services.AddOpenTelemetry()
+ // .UseAzureMonitor();
+ //}
+
+ return builder;
+ }
+
+ public static IHostApplicationBuilder AddDefaultHealthChecks(this IHostApplicationBuilder builder)
+ {
+ builder.Services.AddHealthChecks()
+ // Add a default liveness check to ensure app is responsive
+ .AddCheck("self", () => HealthCheckResult.Healthy(), ["live"]);
+
+ return builder;
+ }
+
+ public static WebApplication MapDefaultEndpoints(this WebApplication app)
+ {
+ // Adding health checks endpoints to applications in non-development environments has security implications.
+ // See https://aka.ms/dotnet/aspire/healthchecks for details before enabling these endpoints in non-development environments.
+ if (app.Environment.IsDevelopment())
+ {
+ // All health checks must pass for app to be considered ready to accept traffic after starting
+ app.MapHealthChecks("/health");
+
+ // Only health checks tagged with the "live" tag must pass for app to be considered alive
+ app.MapHealthChecks("/alive", new HealthCheckOptions
+ {
+ Predicate = r => r.Tags.Contains("live")
+ });
+ }
+
+ return app;
+ }
+}
diff --git a/src/AntSK.sln b/src/AntSK.sln
index c26d2fd..79f126a 100644
--- a/src/AntSK.sln
+++ b/src/AntSK.sln
@@ -27,6 +27,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AntSK.LLamaFactory", "AntSK
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AntSK.OCR", "AntSK.OCR\AntSK.OCR.csproj", "{6195F7AA-18C2-4372-85CA-11FC4B522686}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Aspire", "Aspire", "{8578F0F2-5DE5-45EF-AE54-C37A07B62248}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AntSKWeb", "AntSKWeb", "{F341BA6B-E329-42F7-8005-1E366C8A7B1F}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AntSK.AppHost", "AntSK.AppHost\AntSK.AppHost.csproj", "{3EEC5A22-2C4D-4D6F-9039-C4AF3FEA3418}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AntSK.ServiceDefaults", "AntSK.ServiceDefaults\AntSK.ServiceDefaults.csproj", "{21AC6184-336E-475F-8975-80A39D59B0CC}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -61,12 +69,28 @@ Global
{6195F7AA-18C2-4372-85CA-11FC4B522686}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6195F7AA-18C2-4372-85CA-11FC4B522686}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6195F7AA-18C2-4372-85CA-11FC4B522686}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3EEC5A22-2C4D-4D6F-9039-C4AF3FEA3418}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3EEC5A22-2C4D-4D6F-9039-C4AF3FEA3418}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3EEC5A22-2C4D-4D6F-9039-C4AF3FEA3418}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3EEC5A22-2C4D-4D6F-9039-C4AF3FEA3418}.Release|Any CPU.Build.0 = Release|Any CPU
+ {21AC6184-336E-475F-8975-80A39D59B0CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {21AC6184-336E-475F-8975-80A39D59B0CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {21AC6184-336E-475F-8975-80A39D59B0CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {21AC6184-336E-475F-8975-80A39D59B0CC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
+ {9AA5A735-8FB1-4CC5-AB3E-D02B3A3B6682} = {F341BA6B-E329-42F7-8005-1E366C8A7B1F}
+ {64F17C9A-97C2-46FA-9345-86C5289288AD} = {F341BA6B-E329-42F7-8005-1E366C8A7B1F}
{DF87E829-99C5-44A7-9718-B3E67DC801F6} = {40DDB1DC-571B-4A95-9F34-47F52981C511}
+ {19529BFA-152F-4A8C-8254-F2D4896AB739} = {F341BA6B-E329-42F7-8005-1E366C8A7B1F}
+ {6AD71410-127F-4C83-95A8-F699C39B44FF} = {F341BA6B-E329-42F7-8005-1E366C8A7B1F}
+ {664DFA1F-68B7-49C7-B889-FA14D1756D3D} = {F341BA6B-E329-42F7-8005-1E366C8A7B1F}
+ {6195F7AA-18C2-4372-85CA-11FC4B522686} = {F341BA6B-E329-42F7-8005-1E366C8A7B1F}
+ {3EEC5A22-2C4D-4D6F-9039-C4AF3FEA3418} = {8578F0F2-5DE5-45EF-AE54-C37A07B62248}
+ {21AC6184-336E-475F-8975-80A39D59B0CC} = {8578F0F2-5DE5-45EF-AE54-C37A07B62248}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2076B7C9-2E5B-4580-9712-03F0D56BC1AF}
diff --git a/src/AntSK/AntSK.csproj b/src/AntSK/AntSK.csproj
index 447af36..8754ead 100644
--- a/src/AntSK/AntSK.csproj
+++ b/src/AntSK/AntSK.csproj
@@ -29,6 +29,7 @@
+