using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Volo.Abp; namespace Volo.CmsKit; public class ConsoleTestAppHostedService : IHostedService { public async Task StartAsync(CancellationToken cancellationToken) { using (var application = AbpApplicationFactory.Create()) { application.Initialize(); var demo = application.ServiceProvider.GetRequiredService(); await demo.RunAsync(); application.Shutdown(); } } public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; }