minimal api 踢用户下线 实现
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-10-15 15:42:08 +08:00
parent 947d6dc6d1
commit 74a0c8923c
9 changed files with 99 additions and 48 deletions
+1 -21
View File
@@ -149,6 +149,7 @@ builder.Services.AddMasaMinimalAPIs(options =>
options.RouteHandlerBuilder= t=> {
t.RequireAuthorization()
.AddEndpointFilter<LimitUserRequestAuthorizationEndpointFilter>()
.AddEndpointFilter<UnifiedApiResultEndpointFilter>()
.WithGroupName("Institution");
};
@@ -191,27 +192,6 @@ app.UseStatusCodePages(async context =>
//app.UseExceptionHandler();
app.UseExceptionHandler(o => { });
//这里没生效,原因未知,官方文档也是这种写法,也用了GlobalExceptionHandler 尝试,还是不行,怀疑框架bug
//app.UseExceptionHandler(configure =>
//{
// configure.Run(async context =>
// {
// var exceptionHandlerPathFeature = context.Features.Get<IExceptionHandlerPathFeature>();
//var ex = exceptionHandlerPathFeature?.Error;
//context.Response.ContentType = "application/json";
//if (ex != null)
//{
// var errorInfo = $"Exception: {ex.Message}[{ex.StackTrace}]" + (ex.InnerException != null ? $" InnerException: {ex.InnerException.Message}[{ex.InnerException.StackTrace}]" : "");
// await context.Response.WriteAsync(JsonConvert.SerializeObject(ResponseOutput.NotOk($"{ex?.Message}")));
// Log.Logger.Error(errorInfo);
//}
// });
//});
#region
//app.UseMiddleware<MultiDiskStaticFilesMiddleware>();