diff --git a/ECMJobRunner.WebCron/HealthCheck/HealthCheckHtmlGenerator.cs b/ECMJobRunner.WebCron/HealthCheck/HealthCheckHtmlGenerator.cs
index 22888c5..49b4335 100644
--- a/ECMJobRunner.WebCron/HealthCheck/HealthCheckHtmlGenerator.cs
+++ b/ECMJobRunner.WebCron/HealthCheck/HealthCheckHtmlGenerator.cs
@@ -112,7 +112,7 @@ public static class HealthCheckHtmlGenerator
");
sb.Append(icon);
sb.Append($@" Health Check Status
- Last checked: {DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} UTC
+ Last checked: {DateTime.Now:yyyy-MM-dd HH:mm:ss} UTC
{report.Status}
diff --git a/ECMJobRunner.WebCron/ProfileWorker/ProfileWorker.cs b/ECMJobRunner.WebCron/ProfileWorker/ProfileWorker.cs
index 6a1f054..fd2f3e7 100644
--- a/ECMJobRunner.WebCron/ProfileWorker/ProfileWorker.cs
+++ b/ECMJobRunner.WebCron/ProfileWorker/ProfileWorker.cs
@@ -67,7 +67,7 @@ public class ProfileWorker(
await work.ExecuteAsync(stoppingToken);
// Success - update health state
- _lastSuccessfulRun = DateTime.UtcNow;
+ _lastSuccessfulRun = DateTime.Now;
_consecutiveFailures = 0;
_lastException = null;
@@ -151,7 +151,7 @@ public class ProfileWorker(
));
}
- var timeSinceLastSuccess = DateTime.UtcNow - _lastSuccessfulRun.Value;
+ var timeSinceLastSuccess = DateTime.Now - _lastSuccessfulRun.Value;
// Adaptive multiplier: 3x for fast intervals (<10s), 1.5x for slower intervals
// This ensures faster problem detection when using longer intervals (e.g., 60s)
diff --git a/ECMJobRunner.WebCron/Program.cs b/ECMJobRunner.WebCron/Program.cs
index 611d8b8..e359a99 100644
--- a/ECMJobRunner.WebCron/Program.cs
+++ b/ECMJobRunner.WebCron/Program.cs
@@ -2,6 +2,7 @@ using ECMJobRunner.Application;
using ECMJobRunner.Infrastructure;
using ECMJobRunner.WebCron;
using ECMJobRunner.WebCron.HealthCheck;
+using ECMJobRunner.WebCron.Middleware;
using ECMJobRunner.WebCron.ProfileWorker;
using Hangfire;
using Hangfire.SqlServer;
@@ -65,7 +66,7 @@ builder.Services.AddJobRunnerInfrastructure(cnnStr);
var recClientApiUrl = builder.Configuration.GetValue
("ReC:ApiUrl")
?? throw new InvalidOperationException("ReC:ApiUrl not found.");
-builder.Services.AddJobRunnerServices(recClientApiUrl);
+builder.Services.AddJobRunnerServices(recClientApiUrl, builder.Configuration);
// Get Hangfire storage configuration
var useInMemory = builder.Configuration.GetValue("Hangfire:InMemory");
@@ -105,7 +106,7 @@ builder.Services.AddSwaggerGen();
// Add health checks
builder.Services.AddHealthChecks()
- .AddCheck("profile-worker", tags: new[] { "ready", "worker" });
+ .AddCheck("profile-worker", tags: ["ready", "worker"]);
// Add Serilog.UI with SQLite provider - use same path from configuration
var serilogUiLogDirectory = builder.Configuration.GetValue("Application:LogDirectory")
@@ -123,6 +124,8 @@ builder.Services.AddSerilogUi(logUIOpt =>
var app = builder.Build();
+app.UseMiddleware();
+
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
@@ -171,7 +174,7 @@ app.MapHealthChecks("/health", new Microsoft.AspNetCore.Diagnostics.HealthChecks
var result = System.Text.Json.JsonSerializer.Serialize(new
{
status = report.Status.ToString(),
- timestamp = DateTime.UtcNow,
+ timestamp = DateTime.Now,
checks = report.Entries.Select(e => new
{
name = e.Key,