| | |
| | | using Autofac.Core; |
| | | using WIDESEAWCS_QuartzJob.QuartzExtensions; |
| | | using Microsoft.AspNetCore.Builder; |
| | | using System.Configuration; |
| | | using WIDESEAWCS_Server.HostedService; |
| | | using WIDESEAWCS_Tasks; |
| | | |
| | | var builder = WebApplication.CreateBuilder(args); |
| | | |
| | |
| | | }); ; |
| | | builder.ConfigureApplication(); |
| | | |
| | | //App.ExpDateTime = DateTime.Parse("2025-05-31 00:00:00"); |
| | | |
| | | // 2、配置服务 |
| | | builder.Services.AddSingleton(new AppSettings(builder.Configuration));//注册 |
| | |
| | | builder.Services.AddInitializationHostServiceSetup();//应用初始化服务注入 |
| | | builder.Services.AddDbSetup();//Db 启动服务 |
| | | |
| | | //builder.Services.AddScoped<QuartzJobCreateDataTabel>(); |
| | | //builder.Services.AddHostedService<QuartzJobDataTableHostedService>(); |
| | | builder.Services.AddScoped<QuartzJobCreateDataTabel>(); |
| | | builder.Services.AddHostedService<WarehouseHostedService>(); |
| | | builder.Services.AddHostedService<QuartzJobDataTableHostedService>(); |
| | | |
| | | //builder.Services.AddWebSocketSetup(); |
| | | |
| | | builder.Services.AddAutoMapperSetup(); |
| | | |
| | |
| | | |
| | | builder.Services.AddHttpContextSetup(); |
| | | |
| | | builder.Services.AddHostedService<QuartzJobHostedService>();//任务调度 启动服务 |
| | | builder.Services.AddHostedService<QuartzJobHostedService>(); |
| | | |
| | | builder.Services.AddMvc(options => |
| | | { |
| | |
| | | app.UseMiniProfiler();//性能分析器 |
| | | app.ConfigureApplication();//配置文件 |
| | | app.UseApplicationSetup();//启动配置 |
| | | |
| | | app.UseAllServicesMiddle(builder.Services); |
| | | |
| | | app.UseSession(); |
| | | |
| | | |
| | | |
| | | //if (app.Environment.IsDevelopment()) |
| | | if (app.Environment.IsProduction()) |
| | | { |
| | | //todo |
| | | //app.UseSwaggerAuthorized(); |
| | | app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEAWCS_Server.index.html")); |
| | | app.UseSwaggerAuthorized(); |
| | | |
| | | }//判断是否需要打开swagger |
| | | |
| | | app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEAWCS_Server.index.html") ?? throw new Exception("未找到WIDESEAWCS_Server.index.html文件")); |
| | | |
| | | app.UseIpLimitMiddle(); |
| | | app.UseApiLogMiddleware(); |
| | | |
| | | //todo |
| | | //app.UseRecordAccessLogsMiddle(); |
| | | |
| | |
| | | |
| | | app.MapControllers(); |
| | | |
| | | //BarcodeScanner.StartServer(); |
| | | app.Run(); |
| | | |