diff --git a/aspnet-core/services/LY.AIO.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs b/aspnet-core/services/LY.AIO.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs index 5ec0178f6..a1c86c618 100644 --- a/aspnet-core/services/LY.AIO.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs +++ b/aspnet-core/services/LY.AIO.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs @@ -858,7 +858,10 @@ public partial class MicroServiceApplicationsSingleModule options.AutoValidate = false; }); - services.Replace(ServiceLifetime.Scoped); + var originalDescriptor = services.FirstOrDefault(d => d.ServiceType == typeof(CookieAuthenticationHandler)); + var originalLifetime = originalDescriptor?.Lifetime ?? ServiceLifetime.Transient; // 默认用 Transient + + services.Replace(originalLifetime); services.AddAuthentication() .AddAbpJwtBearer(options =>