Part of Anarchy I/O Toolkit, a .NET developer platform · Pillar: Infrastructure · Layer: Hosting · Package catalog

Generic startup and entry-point infrastructure for jobs and worker processes.

dotnet add package Anarchy.Toolkit.Hosting
  • Implement IStartup and use UseStartup<TStartup>(appRunnerType) to compose a host.
  • Build jobs and workers with JobStartupBase, JobEntryPointBase, WorkerEntryPointBase and AppHostBuilder.
  • Override ConfigureAppConfiguration to select the application’s configuration sources; DiFactory<TAppSettingsDiModule, TAppSettings> builds the service container.

When to use it

Use Hosting for the composition and lifecycle of a job or worker that is not itself an HTTP API. It separates application startup and service registration from the executable entry point, allowing the same conventions to be used in different hosting environments.

How to use it

  1. Define your settings and settings module using Anarchy.Toolkit.Configuration.
  2. Implement an IStartup or derive from the relevant startup base. Register application services and any toolkit modules in the startup’s service-configuration hook.
  3. Create an entry point using the appropriate job or worker base; run the host and dispose it when the process exits. Select configuration sources in ConfigureAppConfiguration when the defaults are insufficient.

See the runnable worker startup, worker entry point, and Lambda job for concrete implementations. For REST endpoints, use Anarchy.Toolkit.Web; for long-running worker and health primitives, add Hosting.Workers.

See the sample applications and toolkit overview.

Releases

See the release notes for the complete release history.