食人鱼CMS设置运行状况检查

Piranha CMS Setup HealthChecks

提问人:Jesse 提问时间:12/7/2022 最后编辑:Jesse 更新时间:12/14/2022 访问量:69

问:

我正在尝试使用 Piranha CMS 设置 HealthCheck。这些在本地工作正常,但是一旦我部署了端点,就会出现 500 个内部错误。在Piranha CMS注册HealthCheck时,我是否缺少什么。我尝试将这些移动到应用程序中。使用食人鱼(options =>和服务。AddPiranha(options =>,但仍然无法访问 HealthCheck 端点。

这两者都高于食人鱼注册。

    services.AddHealthChecks()
          .AddCheck<DealerUserSyncHealthCheck>("DealerSync Health Check", null, new[] { "DealerSync" })
          .AddCheck<VendorSyncHealthCheck>("VendorSync Health Check", null, new[] { "VendorSync" })
          .AddCheck<ContactUserSyncHealthCheck>("ContactUserSync Health Check", null, new[] { "ContactUserSync" })
          .AddCheck<DbHealthCheck>("Db Health Check", null, new[] { "Db" })
          .AddCheck<SendGridHealthCheck>("SendGrid Health Check", null, new[] { "SendGrid" })
          .AddCheck<RedisHealthCheck>("Redis Health Check", null, new[] { "Redis" });

  OBESettings settings = new OBESettings();
        Configuration.Bind(settings);

        // Setup Health Check Endpoints
        app.UseEndpoints(endpoints =>
        {
            endpoints.MapHealthChecks("/DealerSyncCheck", new HealthCheckOptions
            {
                Predicate = healthCheck => healthCheck.Tags.Contains("DealerSync")
            });//.RequireHost(settings.HealthCheckWhitelist);
            endpoints.MapHealthChecks("/VendorSyncCheck", new HealthCheckOptions
            {
                Predicate = healthCheck => healthCheck.Tags.Contains("VendorSync")
            });//.RequireHost(settings.HealthCheckWhitelist);
            endpoints.MapHealthChecks("/ContactUserSyncCheck", new HealthCheckOptions
            {
                Predicate = healthCheck => healthCheck.Tags.Contains("ContactUserSync")
            });//.RequireHost(settings.HealthCheckWhitelist);
            endpoints.MapHealthChecks("/DbCheck", new HealthCheckOptions
            {
                Predicate = healthCheck => healthCheck.Tags.Contains("Db")
            });//.RequireHost(settings.HealthCheckWhitelist);
            endpoints.MapHealthChecks("/SendGridCheck", new HealthCheckOptions
            {
                Predicate = healthCheck => healthCheck.Tags.Contains("SendGrid")
            });//.RequireHost(settings.HealthCheckWhitelist);
            endpoints.MapHealthChecks("/RedisCheck", new HealthCheckOptions
            {
                Predicate = healthCheck => healthCheck.Tags.Contains("Redis")
            });//.RequireHost(settings.HealthCheckWhitelist);

        });
健康检查 食人鱼-CMS

评论


答:

0赞 Jesse 12/14/2022 #1

从那以后,我已将健康检查注册移至服务之上。AddPiranha 和应用程序。使用食人鱼注册。我不得不重新添加对服务的调用。AddControllers();用于 ConfigureServices 和应用。UseRouting();用于配置。现在,部署后一切正常。