| | |
| | | using Furion; |
| | | using Consul; |
| | | using Furion; |
| | | using Furion.EventBus; |
| | | using MediatR; |
| | | using Microsoft.AspNetCore.Builder; |
| | |
| | | { |
| | | public void ConfigureServices(IServiceCollection services) |
| | | { |
| | | services.AddHealthChecks(); |
| | | |
| | | services.AddConsoleFormatter(options => |
| | | { |
| | | options.WithTraceId = true; |
| | | options.WithStackFrame = true; |
| | | }); |
| | | |
| | | services.AddFileLogging(options => |
| | | { |
| | | options.WithTraceId = true; |
| | | options.WithStackFrame = true; |
| | | options.FileNameRule = fileName => |
| | | { |
| | | return string.Format(fileName, DateTime.UtcNow); // 如果是本地时间使用 DateTime.Now |
| | |
| | | services.AddDatabaseLogging<DatabaseLoggingWriter>(options => |
| | | { |
| | | options.WithTraceId = true; |
| | | options.WithStackFrame = true; |
| | | }); |
| | | |
| | | services.AddConfigurableOptions<AliyunOptions>(); |
| | | |
| | | services.AddHttpRemote(); |
| | | |
| | | services.AddComponent<ConsulServiceComponent>(); |
| | | |
| | | services.AddComponent<EventBusServiceComponent>(); |
| | | |
| | |
| | | .AddFriendlyException() |
| | | .AddDataValidation() |
| | | .AddInjectWithUnifyResult<FriendlyResultProvider>(); |
| | | |
| | | services.AddMvcFilter<ResourceActionFilter>(); |
| | | } |
| | | |
| | | public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime) |
| | |
| | | app.UseEndpoints(endpoints => |
| | | { |
| | | endpoints.MapControllers(); |
| | | endpoints.MapHealthChecks("/healthz"); |
| | | }); |
| | | |
| | | app.UseComponent<ConsulApplicationComponent>(env); |
| | | |
| | | //lifetime.ApplicationStarted.Register(async () => |
| | | //{ |
| | | // await ResourceUtils.BuildDynamicControllersAsync(); |