Skip to content

CLI is running all registered IHostedService #2712

@desjoerd

Description

@desjoerd

Currently the CLI is running all registered Hosted Services (IHostedService). I see that it's needed to start the application because otherwise the app.Use*/app.Map* configuration is not run. Because it's starting the application (with a NoopServer) it is running all registered HostedServices.

Because the CLI is almost always run in the context of a build it would be nice to not run those registered hosted services. This would also solve instances of for example HangFire or other things which start an IHostedService.

I've got a fix which I would like to discuss. It's a bit dirty but it works in my tests.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions