hutongqing
2025-01-15 515866f63c9fbdb83de3f2016e4eaf2af99490d7
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs
@@ -21,6 +21,7 @@
using Autofac.Core;
using WIDESEAWCS_QuartzJob.QuartzExtensions;
using Microsoft.AspNetCore.Builder;
using WIDESEAWCS_Server.HostedService;
var builder = WebApplication.CreateBuilder(args);
@@ -47,7 +48,10 @@
builder.Services.AddDbSetup();//Db å¯åŠ¨æœåŠ¡
builder.Services.AddScoped<QuartzJobCreateDataTabel>();
builder.Services.AddHostedService<WarehouseHostedService>();
builder.Services.AddHostedService<QuartzJobDataTableHostedService>();
builder.Services.AddWebSocketSetup();
builder.Services.AddAutoMapperSetup();
@@ -110,13 +114,15 @@
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") ?? 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();
//todo