From aa004c5dab7f837d3790bd5f5c1926ea577e9b26 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 31 Oct 2024 17:18:35 +0800 Subject: [PATCH] Use `IAbpApplicationConfigurationAppService` to check website health. --- .../HealthChecks/EShopOnAbpHealthCheck.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/HealthChecks/EShopOnAbpHealthCheck.cs b/apps/public-web/src/EShopOnAbp.PublicWeb/HealthChecks/EShopOnAbpHealthCheck.cs index 083f73a4..4bb5ddc0 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/HealthChecks/EShopOnAbpHealthCheck.cs +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/HealthChecks/EShopOnAbpHealthCheck.cs @@ -2,25 +2,28 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Diagnostics.HealthChecks; +using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; using Volo.Abp.DependencyInjection; -using Volo.Abp.Identity; namespace EShopOnAbp.PublicWeb.HealthChecks; public class EShopOnAbpHealthCheck : IHealthCheck, ITransientDependency { - protected readonly IIdentityUserAppService IdentityUserAppService; + protected readonly IAbpApplicationConfigurationAppService ApplicationConfigurationAppService; - public EShopOnAbpHealthCheck(IIdentityUserAppService identityUserAppService) + public EShopOnAbpHealthCheck(IAbpApplicationConfigurationAppService applicationConfigurationAppService) { - IdentityUserAppService = identityUserAppService; + ApplicationConfigurationAppService = applicationConfigurationAppService; } public async Task CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) { try { - await IdentityUserAppService.GetListAsync(new GetIdentityUsersInput { MaxResultCount = 1 }); + await ApplicationConfigurationAppService.GetAsync(new ApplicationConfigurationRequestOptions() + { + IncludeLocalizationResources = false + }); return HealthCheckResult.Healthy($"Could connect to database and get record."); }