using HealthChecks.UI.Client; using Hinse.Serilog; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Senparc.CO2NET; using Serilog; using YB.DeviceV2.Web.Entry.Controllers; var builder = WebApplication.CreateBuilder(args).Inject(); builder.Host.UseSerilogDefault(lc=>lc .Enrich.WithProperty("Application", typeof(Program).Assembly.GetName().Name) //.ReadFrom.Configuration(services.GetRequiredService()) //.ReadFrom.Services(services) .Enrich.WithMachineName() .Enrich.WithEnvironmentUserName() .Enrich.WithProcessId() .Enrich.WithProcessName() .Enrich.WithClientIp() .Enrich.WithCorrelationId() //.Enrich.WithRequestHeader("","") //.Enrich.FromLogContext() //.Enrich.WithRequestHeader("Header-Name1") //.WriteTo.Seq("http://localhost:5341") .WriteTo.Console(/*Formatters.CreateConsoleTextFormatter(TemplateTheme.Code)*/)); //引入微信服务 builder.Host.UseServiceProviderFactory(new SenparcServiceProviderFactory()); builder.Services.Configure( builder.Configuration.GetSection("DiyQrRedirectOptions")); var app = builder.Build(); // 检查检查映射 app.MapHealthChecks("/healthz", new HealthCheckOptions { Predicate = _ => true, ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse }); app.Run();