From abca6480a1e979b428dd6e3e5f495a7f5835f2ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Thu, 12 Feb 2026 11:38:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20=E8=BF=87=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E6=89=93=E5=8C=85=E9=85=8D=E7=BD=AEAI=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Learn.VideoAnalysis.API/Program.cs | 16 +++++++- VideoAnalysis/.config/dotnet-tools.json | 13 +++++++ VideoAnalysis/Program.cs | 23 ++++++++++- VideoAnalysisCore/VideoAnalysisCore.csproj | 45 ---------------------- 4 files changed, 49 insertions(+), 48 deletions(-) create mode 100644 VideoAnalysis/.config/dotnet-tools.json 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 - -