diff --git a/Learn.VideoAnalysis.API/Program.cs b/Learn.VideoAnalysis.API/Program.cs index f421d75..fe52835 100644 --- a/Learn.VideoAnalysis.API/Program.cs +++ b/Learn.VideoAnalysis.API/Program.cs @@ -1,6 +1,8 @@ using Learn.VideoAnalysis.API.Expand; using Mapster; +using Microsoft.AspNetCore.Hosting.Server.Features; +using Microsoft.AspNetCore.Hosting.Server; using Microsoft.OpenApi.Models; using System.Text.Encodings.Web; using System.Text.Json; @@ -79,7 +81,19 @@ namespace Learn.VideoAnalysis.API app.UseCorsExpand(); app.UseSqlSugarExpand(); app.UseCoravelExpand(); - + // 注册启动后的回调 + app.Lifetime.ApplicationStarted.Register(() => + { + var server = app.Services.GetRequiredService(); + var addressFeature = server.Features.Get(); + Console.WriteLine("==========================================="); + Console.WriteLine($"Kestrel 监听地址: "); + foreach (var address in addressFeature.Addresses) + { + Console.WriteLine($"{address}"); + } + Console.WriteLine("==========================================="); + }); app.Run(); } diff --git a/VideoAnalysis/.config/dotnet-tools.json b/VideoAnalysis/.config/dotnet-tools.json new file mode 100644 index 0000000..bffb60c --- /dev/null +++ b/VideoAnalysis/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "10.0.3", + "commands": [ + "dotnet-ef" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/VideoAnalysis/Program.cs b/VideoAnalysis/Program.cs index 40f0044..5ed3ecb 100644 --- a/VideoAnalysis/Program.cs +++ b/VideoAnalysis/Program.cs @@ -16,6 +16,8 @@ using VideoAnalysisCore.AICore.FFMPGE; using System.Text.Encodings.Web; using System.Text.Unicode; using System.Text.Json; +using Microsoft.AspNetCore.Hosting.Server.Features; +using Microsoft.AspNetCore.Hosting.Server; @@ -28,7 +30,8 @@ namespace Learn.VideoAnalysis var builder = WebApplication.CreateBuilder(args); //设置接口请求体最大100m - builder.WebHost.ConfigureKestrel(serverOptions => { + builder.WebHost.ConfigureKestrel(serverOptions => + { serverOptions.Limits.MaxRequestBodySize = 100_000_000; // 100MB }); builder.Services.AddLogging(loggingBuilder => @@ -38,6 +41,7 @@ namespace Learn.VideoAnalysis loggingBuilder.SetMinimumLevel(LogLevel.Warning); // 设置最小日志级别为 Warning }); + //绑定 appsetting 配置 builder.Configuration.AddAppConfig(args); //初始化 插件 @@ -103,7 +107,7 @@ namespace Learn.VideoAnalysis //开启redis队列服务 _ = app.Services.GetRequiredService(); app.UseSwagger(); - app.UseSwaggerUI(); + app.UseSwaggerUI(); app.UseExceptionHandler("/Error"); //添加wwwroot 静态目录 @@ -128,6 +132,21 @@ namespace Learn.VideoAnalysis app.UseSqlSugarExpand(); app.UseCoravelExpand(); + // 注册启动后的回调 + app.Lifetime.ApplicationStarted.Register(() => + { + var server = app.Services.GetRequiredService(); + var addressFeature = server.Features.Get(); + Console.WriteLine("==========================================="); + Console.WriteLine($"Kestrel 监听地址: "); + foreach (var address in addressFeature.Addresses) + { + Console.WriteLine($"{address}"); + } + Console.WriteLine("==========================================="); + }); + + app.Run(); } diff --git a/VideoAnalysisCore/VideoAnalysisCore.csproj b/VideoAnalysisCore/VideoAnalysisCore.csproj index 6b3ce02..ae987c4 100644 --- a/VideoAnalysisCore/VideoAnalysisCore.csproj +++ b/VideoAnalysisCore/VideoAnalysisCore.csproj @@ -9,53 +9,8 @@ - - - - - - - - - - - - - Never - - - Always - - - Always - - - Always - - - Never - - - Never - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - Never - -