| | |
| | | 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 |
| | | return string.Format(fileName, DateTime.Now); |
| | | }; |
| | | }); |
| | | |
| | | services.AddDatabaseLogging<DatabaseLoggingWriter>(options => |
| | | { |
| | | options.WithTraceId = true; |
| | | options.WithStackFrame = true; |
| | | }); |
| | | //services.AddDatabaseLogging<DatabaseLoggingWriter>(options => |
| | | //{ |
| | | // options.WithTraceId = true; |
| | | //}); |
| | | |
| | | services.AddConfigurableOptions<AliyunOptions>(); |
| | | |
| | | services.AddComponent<ConsulServiceComponent>(); |
| | | |
| | | services.AddComponent<EventBusServiceComponent>(); |
| | | |
| | | services.AddComponent<DistributedCacheServiceComponent>(); |
| | | |
| | | services.AddHttpRemote(); |
| | | services.AddSingleton<ResourceHttpUtils>(); |
| | | |
| | | services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblies(App.Assemblies.ToArray())); |
| | | |
| | | services.AddHostedService<XmlDocBuildHostedService>(); |
| | | services.AddHostedService<BuildDynamicControllersHostedService>(); |
| | | |
| | | services.AddJwt<JwtHandler>(enableGlobalAuthorize: true); |
| | | |
| | | services.AddCorsAccessor(); |
| | | |
| | | services.AddHostedService<BuildDynamicControllersHostedService>(); |
| | | |
| | | services.AddSpecificationDocuments(options => |
| | | { |
| | |
| | | .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(); |