| | |
| | | using Microsoft.AspNetCore.Builder; |
| | | using WIDESEAWCS_Server.Filter; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_Server.HostedService; |
| | | |
| | | var builder = WebApplication.CreateBuilder(args); |
| | | |
| | | App.ExpDateTime = DateTime.Parse("2025-01-01 00:00:00"); |
| | | |
| | | builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory()).ConfigureContainer<ContainerBuilder>(builder => |
| | | { |
| | |
| | | |
| | | //builder.Services.AddScoped<QuartzJobCreateDataTabel>();//任务调度 注入创建QuartzJob数据库表类 |
| | | //builder.Services.AddHostedService<QuartzJobDataTableHostedService>();//任务调度 映射QuartzJob数据库表 |
| | | |
| | | builder.Services.AddWebSocketSetup(); |
| | | |
| | | builder.Services.AddAutoMapperSetup(); |
| | | |
| | |
| | | app.UseAllServicesMiddle(builder.Services); |
| | | |
| | | app.UseSession(); |
| | | //if (app.Environment.IsDevelopment()) |
| | | //if (app.Environment.IsProduction()) |
| | | { |
| | | app.UseSwaggerAuthorized(); |
| | | app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEAWCS_Server.index.html") ?? throw new Exception("未找到WIDESEAWCS_Server.index.html文件")); |
| | | }//判断是否需要打开swagger |
| | | } |
| | | |
| | | app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEAWCS_Server.index.html") ?? throw new Exception("未找到WIDESEAWCS_Server.index.html文件")); |
| | | |
| | | app.UseIpLimitMiddle(); |
| | | app.UseApiLogMiddleware(); |