From be1190971319d9c6f7ee553de9b27885e2c90e8b Mon Sep 17 00:00:00 2001 From: lg <999544862qq.com> Date: 星期三, 14 八月 2024 15:48:45 +0800 Subject: [PATCH] 陆工,增加异常过滤 --- MESApplication/Startup.cs | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/MESApplication/Startup.cs b/MESApplication/Startup.cs index f506f0e..17e9bf6 100644 --- a/MESApplication/Startup.cs +++ b/MESApplication/Startup.cs @@ -66,6 +66,14 @@ "OPTIONS") ); }); + + #region 鎺ュ彛琛屽姩杩囨护鍣� + services.AddControllers(options => { + options.Filters.Add(new ActionFilter()); + }); + var serviceProvider = services.BuildServiceProvider(); + ActionFilter.LoggerError = serviceProvider.GetRequiredService<ILogger<ActionFilter>>(); + #endregion } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -92,5 +100,10 @@ app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); + + ////////////////////////// + + /////////////////////////// + } } \ No newline at end of file -- Gitblit v1.9.3