© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
7 replies
int

"Application started" after "Application is shutting down"

var builder = Host.CreateApplicationBuilder(args);
builder.Logging.AddConsole();
builder.Services.AddSingleton<IDatabaseSerializer, EqualsDatabaseSerializer>();
builder.Services.AddSingleton<Database>();
builder.Services.AddHostedService<App>();

var host = builder.Build();
await host.RunAsync();
var builder = Host.CreateApplicationBuilder(args);
builder.Logging.AddConsole();
builder.Services.AddSingleton<IDatabaseSerializer, EqualsDatabaseSerializer>();
builder.Services.AddSingleton<Database>();
builder.Services.AddHostedService<App>();

var host = builder.Build();
await host.RunAsync();
info: Kevin.App[0]
      Listening on port localhost:5371
info: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Users\     \Desktop\Dev\Projects\Kevin
info: Kevin.App[0]
      Listening on port localhost:5371
info: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Users\     \Desktop\Dev\Projects\Kevin
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Uncaught OperationCancelledException when shutting down IHostedService
C#CC# / help
16mo ago
SQLite proper disposal when shutting down the app
C#CC# / help
11mo ago
Application is unable to load assemblies after the IIS pool is recycled.
C#CC# / help
2y ago
Filesystem packer slows down after 30k files
C#CC# / help
2y ago