diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs index 033fef813f..295a8bd100 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs @@ -20,6 +20,7 @@ namespace Microsoft.AspNetCore.Builder { Check.NotNull(app, nameof(app)); + app.ApplicationServices.GetRequiredService>().Value = app; var application = app.ApplicationServices.GetRequiredService(); var applicationLifetime = app.ApplicationServices.GetRequiredService(); @@ -33,7 +34,6 @@ namespace Microsoft.AspNetCore.Builder application.Dispose(); }); - app.ApplicationServices.GetRequiredService>().Value = app; application.Initialize(app.ApplicationServices); }