Chapter 34: Building background tasks and ser vices
This chapter introduces ASP.NET Core approaches for running noninteractive background work, from built-in hosted services to headless workers and Quartz.NET scheduling.
After this chapter you will be able to
- Hosted service support. Explain that ASP.NET Core provides IHostedService as the built-in abstraction for running a background task when an application starts. Describe BackgroundService as a helper for creating timer-based tasks and note that long-running tasks must manage DI lifetimes correctly.
- Headless worker services. Describe a headless worker service as an application built with the generic IHost that contains only IHostedService background tasks, not Razor Pages, API controllers, or minimal API endpoints. State that such an app can be configured and installed as a Windows Service or Linux daemon.
- Background task purpose. Explain why an application moves work such as email processing, message-bus event handling, or batch calculations into a background task. Describe how queuing work lets the application return a response promptly while the task processes the work later.
- IHostedService application lifecycle. Describe IHostedService as the ASP.NET Core interface for running background tasks, and trace its lifetime: implementing classes start when the application starts, shortly after it begins handling requests, and stop shortly before the application stops.
- Background cache refresh pattern. Explain how a periodically running background task can fetch exchange rates in advance and store them in a cache so an API endpoint reads cached values instead of calling a third-party API during each request.
- BackgroundService execution lifecycle. Describe how BackgroundService simplifies IHostedService for long-running work: override ExecuteAsync(), run the repeating work there, and stop the loop when the supplied CancellationToken indicates application shutdown.
- Startup readiness tradeoff. Distinguish the normal requirement that StartAsync() return immediately for lifetime-long background work from the deliberate choice to block startup until an initial rate refresh completes; explain that blocking guarantees initial data availability but can prevent the app from starting if retrieval fails.
- Hosted service lifetime constraints. Explain why an IHostedService is effectively a singleton and why it cannot receive a scoped service such as an EF Core DbContext through constructor injection.
- Manual scope creation and disposal. Describe how a background service creates an IServiceScope from IServiceProvider.CreateScope(), resolves scoped services from that scope, performs one iteration of work, and disposes the scope, normally with using.
- Worker service definition. Explain that a worker, or headless service, is a .NET application built on the generic IHost that does not include ASP.NET Core HTTP-request-handling libraries or expose a UI. Describe typical worker duties such as batch jobs, scheduled repeated tasks, or handling message-bus events.
- Generic host versus ASP.NET Core. Describe that the generic IHost supplies shared application features including configuration, logging, and dependency injection, while ASP.NET Core adds the HTTP middleware pipeline and web paradigms such as Razor Pages and MVC controllers. Justify using IHost alone when HTTP handling is unnecessary because it reduces memory footprint, startup time, and security surface area.
- Worker service template creation. Describe how to create a worker service with the Visual Studio Worker Service template or the dotnet new worker CLI command, and identify the roles of Worker.cs and Program.cs in the generated project.
- Generic host configuration. Explain that the worker template builds and runs an IHost through Host.CreateDefaultBuilder rather than minimal-hosting WebApplicationBuilder and WebApplication APIs, and describe configuring DI with IHostBuilder.ConfigureServices.
- Production hosting options. Describe why worker services are deployed as Windows Services on Windows or systemd daemons on Linux, and identify the hosting integrations required for each platform.
- Windows Service installation. Trace the minimum steps for installing a worker service as a Windows Service: add the Windows Services package, call UseWindowsService(), publish the app, and use the elevated sc utility with the published executable and a service name.
- Quartz.NET scheduling purpose. Explain why Quartz.NET is useful when interval-based background tasks need more precise schedules, such as a particular minute each hour or the second Tuesday of a month. State that Quartz.NET provides this scheduling functionality rather than requiring the application to build it itself.
- Quartz.NET component roles. Describe the four Quartz.NET concepts: jobs contain background-task logic, triggers determine when jobs run, the job factory creates job instances, and the scheduler tracks triggers and creates and runs jobs. Explain that a job may have multiple triggers and that ASP.NET Core DI can be used in job classes through Quartz.NET integration.
- Clustering and long-lived services. Explain that Quartz.NET can run in a clustered environment where multiple application instances coordinate and distribute jobs, so only one service runs a given task at a time while instances provide redundancy. Distinguish this long-lived background-service approach from cron or Task Scheduler, which periodically launch a typically short-lived application or script.
- Quartz.NET hosting model. Explain that Quartz.NET runs background jobs through the IHostedService abstractions, and define a Quartz.NET job as a task whose logic is implemented through the IJob interface.
- Quartz scheduler registration. Describe how to install the Quartz hosting dependency and register Quartz.NET's scheduler as a hosted service with AddQuartzHostedService(), including setting WaitForJobsToComplete=true for graceful shutdown.
- Quartz job responsibilities. Explain that an IJob defines the work to perform, such as downloading exchange rates through ExchangeRatesClient and saving them through AppDbContext, but does not define when that work runs.
- Job lifetime and scoped injection. Describe how Quartz.NET creates a new DI scope and a new IJob instance for every execution, allowing scoped dependencies to be injected directly through the job constructor.
- Trigger scheduling configuration. Describe that Quartz.NET triggers control when a job executes and can express simple recurring schedules or more complex time and calendar rules. State that a job can be registered with AddJob<T>() under a unique name and given a trigger that fires immediately and then every five minutes until shutdown.
- Scaling hazards for background tasks. Explain why independently running IHostedService or BackgroundService instances can duplicate scheduled work when an application is scaled horizontally. Describe the single-worker-service alternative and its limitation when that worker itself needs to scale.
- Quartz.NET clustering coordination. Describe how Quartz.NET clustering distributes scheduled job execution across multiple application instances. Explain that schedulers compete for a database lock when a trigger fires, so only one instance executes the associated IJob.
- Persistent clustered Quartz configuration. Describe the persistence requirements for enabling Quartz.NET clustering: configure a persistent database store and clustering, and create Quartz.NET's required database tables separately. State that job and trigger descriptions, including when triggers last fired, are stored in the database, and that SQLite can provide persistence but cannot support clustering because it lacks the required locking primitives.
What it builds on
- Understanding lifetimes: When are services created? (chapter 9) · Service lifetimes in the DI container.
- Resolving scoped services outside a request (chapter 9) · Resolving scoped services outside an HTTP request.
- Creating a custom IHostBuilder (chapter 30) · The generic IHost and custom IHostBuilder.
- Adding and configuring services (chapter 3) · Adding and configuring services in an ASP.NET Core application.
- Using dependency injection in ASP.NET Core (chapter 8) · Using dependency injection in ASP.NET Core.
- Using typed clients to encapsulate HTTP calls (chapter 33) · The example uses a typed client to make the remote exchange-rate API call.
- Singleton: There can be only one (chapter 9) · Singleton services live for the application's lifetime.
- Using IHttpClientFactory to manage HttpClientHandler lifetime (chapter 33) · IHttpClientFactory manages HttpClientHandler lifetime and rotation.
Section by section
Introduction
This chapter introduces ASP.NET Core approaches for running noninteractive background work, from built-in hosted services to headless workers and Quartz.NET scheduling.
- Background task use cases: Describe what background or batch-task services do and distinguish them from user-facing web applications. Give examples such as processing queued items, sending order-confirmation emails, or calculating retail sales and losses after stores close.
Why it matters: Background work lets an application perform long-running or periodic operations without directly interacting with a user. - Hosted service support: Explain that ASP.NET Core provides IHostedService as the built-in abstraction for running a background task when an application starts. Describe BackgroundService as a helper for creating timer-based tasks and note that long-running tasks must manage DI lifetimes correctly.
Why it matters: Hosted services provide the built-in foundation for background work that runs with an ASP.NET Core application. - Headless worker services: Describe a headless worker service as an application built with the generic IHost that contains only IHostedService background tasks, not Razor Pages, API controllers, or minimal API endpoints. State that such an app can be configured and installed as a Windows Service or Linux daemon.
Why it matters: Headless workers are the appropriate application shape when background processing is the entire application rather than an add-on to a web app. - Quartz.NET scheduling and clustering: Explain that Quartz.NET is an open-source library for extensive background-task scheduling in ASP.NET Core applications. Describe its role in defining complex task schedules and using clustering to add redundancy to worker services.
Why it matters: Quartz.NET is useful when built-in background execution needs more capable scheduling and resilient multi-worker operation.
Key terms: background service, batch-task service, queue, long-running process, IHostedService, BackgroundService, dependency injection, DI lifetimes, worker service, generic IHost
34.1 Running background tasks with IHostedService
This section introduces IHostedService as ASP.NET Core’s mechanism for running application-lifetime background work without blocking user requests.
- Background task purpose: Explain why an application moves work such as email processing, message-bus event handling, or batch calculations into a background task. Describe how queuing work lets the application return a response promptly while the task processes the work later.
Why it matters: Background processing keeps user-facing requests responsive when work does not need to finish before a response is sent. - IHostedService application lifecycle: Describe IHostedService as the ASP.NET Core interface for running background tasks, and trace its lifetime: implementing classes start when the application starts, shortly after it begins handling requests, and stop shortly before the application stops.
Why it matters: The hosted-service lifecycle supplies the start and stop hooks needed to run work throughout an application’s lifetime. - Scoped service access: Describe the need to manage DI container scopes yourself when a singleton background task needs to use services registered with a scoped lifetime.
Why it matters: Managing scopes lets a long-lived background task safely obtain dependencies whose lifetime is scoped.
Key terms: background task, queue, message bus, batch process, IHostedService, Kestrel, application lifetime, scoped lifetime, singleton background task, container scope
34.1.1 Running background tasks on a timer
This section shows how to use hosted background services to refresh cached data on a timer, while managing application startup, cancellation, DI lifetimes, and request-time performance.
- Background cache refresh pattern: Explain how a periodically running background task can fetch exchange rates in advance and store them in a cache so an API endpoint reads cached values instead of calling a third-party API during each request.
Why it matters: Pre-fetching data keeps request handling fast and separates scheduled work from API responses. - BackgroundService execution lifecycle: Describe how BackgroundService simplifies IHostedService for long-running work: override ExecuteAsync(), run the repeating work there, and stop the loop when the supplied CancellationToken indicates application shutdown.
Why it matters: Using ExecuteAsync lets long-running work run for the app lifetime without holding up application startup. - Hosted service registration lifetime: State that AddHostedService() registers a hosted service in the DI container with a singleton lifetime, and explain that shared cache data accessed by both the background service and API requests must be thread-safe.
Why it matters: A hosted service and request handlers can access shared state concurrently, so the lifetime and thread-safety rules affect correctness. - Startup readiness tradeoff: Distinguish the normal requirement that StartAsync() return immediately for lifetime-long background work from the deliberate choice to block startup until an initial rate refresh completes; explain that blocking guarantees initial data availability but can prevent the app from starting if retrieval fails.
Why it matters: The startup choice determines whether an app can accept requests before its background data is ready and how it behaves when initialization fails. - Typed-client lifetime mismatch: Explain why a typed client should not be injected directly into a BackgroundService: typed clients are intended to be short-lived for HttpClient handler rotation, whereas hosted background services are singleton services that live for the application lifetime.
Why it matters: Recognizing incompatible lifetimes helps avoid retaining a short-lived dependency for the entire application lifetime.
Key terms: background task, ExchangeRateCache, typed client, API endpoint, cache, IHostedService, BackgroundService, ExecuteAsync, CancellationToken, StartAsync
34.1.2 Using scoped services in background tasks
This section explains how singleton hosted services can safely use scoped dependencies by creating and disposing a DI scope for each unit of background work.
- Hosted service lifetime constraints: Explain why an IHostedService is effectively a singleton and why it cannot receive a scoped service such as an EF Core DbContext through constructor injection.
Why it matters: Respecting DI lifetimes prevents captive dependencies and incorrect reuse of scoped services. - Manual scope creation and disposal: Describe how a background service creates an IServiceScope from IServiceProvider.CreateScope(), resolves scoped services from that scope, performs one iteration of work, and disposes the scope, normally with using.
Why it matters: A manually managed scope gives background work safe, fresh scoped dependencies and cleans up disposable services. - Scopes outside HTTP requests: State that ASP.NET Core normally creates and disposes a DI scope per HTTP request, whereas background work has no request scope and must create its own; identify Program.cs and OptionsBuilder service resolution as other situations where this pattern applies.
Why it matters: Knowing where request scopes exist helps you recognize when application code must establish an explicit scope.
Key terms: IHostedService, singleton, scoped lifetime, captive dependency, DbContext, constructor injection, IServiceProvider, CreateScope(), IServiceScope, scoped container
34.2 Creating headless worker services using IHost
This section introduces headless worker services as generic-host .NET applications for background work that does not need HTTP or a user interface.
- Worker service definition: Explain that a worker, or headless service, is a .NET application built on the generic IHost that does not include ASP.NET Core HTTP-request-handling libraries or expose a UI. Describe typical worker duties such as batch jobs, scheduled repeated tasks, or handling message-bus events.
Why it matters: This distinction helps you choose a simpler application model when work does not need to serve web requests. - Generic host versus ASP.NET Core: Describe that the generic IHost supplies shared application features including configuration, logging, and dependency injection, while ASP.NET Core adds the HTTP middleware pipeline and web paradigms such as Razor Pages and MVC controllers. Justify using IHost alone when HTTP handling is unnecessary because it reduces memory footprint, startup time, and security surface area.
Why it matters: Knowing which layer provides which features lets you retain hosting capabilities without taking on an unnecessary web stack.
Key terms: worker, worker service, headless service, IHost, IHostedService, generic IHost, ASP.NET Core, middleware pipeline, configuration, logging
34.2.1 Creating a worker service from a template
This section shows how to create a headless worker service from a template and how its hosting, service registration, project references, and execution differ from a typical ASP.NET Core web app.
- Worker service template creation: Describe how to create a worker service with the Visual Studio Worker Service template or the dotnet new worker CLI command, and identify the roles of Worker.cs and Program.cs in the generated project.
Why it matters: The template provides a ready-to-run starting point for a background application without HTTP endpoints. - Generic host configuration: Explain that the worker template builds and runs an IHost through Host.CreateDefaultBuilder rather than minimal-hosting WebApplicationBuilder and WebApplication APIs, and describe configuring DI with IHostBuilder.ConfigureServices.
Why it matters: Understanding the generic host lets you register the background worker and its dependencies in a headless application. - Worker project dependencies: Distinguish the worker service project file from an ASP.NET Core web project file, including its Microsoft.NET.Sdk.Worker SDK and explicit package references that web projects may receive implicitly.
Why it matters: Correct SDK and package references ensure a worker can access hosting and any services it needs without pulling in unnecessary web dependencies. - Worker execution model: State that a worker service runs like an ASP.NET Core application through dotnet run or F5, but is essentially a console application that does not handle HTTP traffic.
Why it matters: This clarifies both how to launch a worker during development and why its deployment choices differ from an HTTP-serving app.
Key terms: Worker Service, dotnet new worker, Worker.cs, Program.cs, BackgroundService, IHost, IHostBuilder, Host.CreateDefaultBuilder, ConfigureServices, HostBuilderContext
34.2.2 Running worker services in production
This section explains how to prepare and install long-running worker services as operating-system-managed services on Windows or Linux.
- Production hosting options: Describe why worker services are deployed as Windows Services on Windows or systemd daemons on Linux, and identify the hosting integrations required for each platform.
Why it matters: Operating-system service hosting lets a long-running worker be monitored and started automatically. - Windows Service installation: Trace the minimum steps for installing a worker service as a Windows Service: add the Windows Services package, call UseWindowsService(), publish the app, and use the elevated sc utility with the published executable and a service name.
Why it matters: These steps make the worker manageable by Windows and allow it to start as an operating-system service. - Hosting integration behavior: Explain that UseWindowsService() has no effect when the application runs during development or as a normal console application, but supplies the hooks needed when it is installed as a Windows Service.
Why it matters: You can keep the same application runnable from the console while making it eligible for service installation.
Key terms: worker service, Windows Service, systemd daemon, Microsoft.Extensions.Hosting.WindowsServices, Microsoft.Extensions.Hosting.Systemd, UseWindowsService(), dotnet publish, sc utility, Services control panel, IHostBuilder
34.3 Coordinating background tasks using Quartz.NET
This section introduces Quartz.NET as a configurable, DI-integrated scheduler for running and coordinating long-lived background jobs in ASP.NET Core applications.
- Quartz.NET scheduling purpose: Explain why Quartz.NET is useful when interval-based background tasks need more precise schedules, such as a particular minute each hour or the second Tuesday of a month. State that Quartz.NET provides this scheduling functionality rather than requiring the application to build it itself.
Why it matters: Quartz.NET lets an application express sophisticated task timing without maintaining custom scheduling code. - Quartz.NET component roles: Describe the four Quartz.NET concepts: jobs contain background-task logic, triggers determine when jobs run, the job factory creates job instances, and the scheduler tracks triggers and creates and runs jobs. Explain that a job may have multiple triggers and that ASP.NET Core DI can be used in job classes through Quartz.NET integration.
Why it matters: Knowing the responsibilities of jobs, triggers, the job factory, and the scheduler makes Quartz.NET configuration understandable. - Clustering and long-lived services: Explain that Quartz.NET can run in a clustered environment where multiple application instances coordinate and distribute jobs, so only one service runs a given task at a time while instances provide redundancy. Distinguish this long-lived background-service approach from cron or Task Scheduler, which periodically launch a typically short-lived application or script.
Why it matters: Clustering prevents duplicate task execution while allowing redundant worker-service instances.
Key terms: Quartz.NET, BackgroundService, schedule, trigger, Jobs, Triggers, Job factory, Scheduler, IHostedService, DI container
34.3.1 Installing Quartz.NET in an ASP.NET Core application
This section installs and configures Quartz.NET as a DI-integrated hosted scheduler in a .NET application, ready for jobs to be added later.
- Quartz.NET hosting model: Explain that Quartz.NET runs background jobs through the IHostedService abstractions, and define a Quartz.NET job as a task whose logic is implemented through the IJob interface.
Why it matters: This connects Quartz.NET scheduling to the background-service model already used by the application. - Quartz scheduler registration: Describe how to install the Quartz hosting dependency and register Quartz.NET's scheduler as a hosted service with AddQuartzHostedService(), including setting WaitForJobsToComplete=true for graceful shutdown.
Why it matters: Correct registration starts the scheduler with the application and prevents in-progress jobs from being abandoned during shutdown. - DI-backed scheduler configuration: Describe configuring Quartz.NET so its job factory resolves job implementations from the dependency injection container, alongside registering the required Quartz services and hosted scheduler.
Why it matters: DI-backed job creation lets scheduled jobs use the application's registered services rather than constructing dependencies manually.
Key terms: Quartz.NET, IHostedService, IJob, job, Quartz.Extensions.Hosting, AddQuartzHostedService, WaitForJobsToComplete, IServiceCollection, WebApplicationBuilder.Services, job factory
34.3.2 Configuring a job to run on a schedule with Quartz.NET
This section shows how to define a Quartz.NET job, schedule it with triggers, and manage its dependency-injection and concurrency behavior.
- Quartz job responsibilities: Explain that an IJob defines the work to perform, such as downloading exchange rates through ExchangeRatesClient and saving them through AppDbContext, but does not define when that work runs.
Why it matters: Separating the work from its schedule lets the same job be run under different timing rules. - Job lifetime and scoped injection: Describe how Quartz.NET creates a new DI scope and a new IJob instance for every execution, allowing scoped dependencies to be injected directly through the job constructor.
Why it matters: This avoids the manual scope creation and service-location approach required when an IHostedService needs scoped services. - Trigger scheduling configuration: Describe that Quartz.NET triggers control when a job executes and can express simple recurring schedules or more complex time and calendar rules. State that a job can be registered with AddJob<T>() under a unique name and given a trigger that fires immediately and then every five minutes until shutdown.
Why it matters: Triggers provide scheduling flexibility without coupling timing logic to the job implementation. - Concurrent execution prevention: State that a long-running IJob can receive the [DisallowConcurrentExecution] attribute so Quartz.NET does not start another instance when a new trigger fires while the job is still running.
Why it matters: Preventing overlapping executions can avoid multiple simultaneous runs of the same long-running task.
Key terms: IJob, UpdateExchangeRatesJob, ExchangeRatesClient, AppDbContext, scoped dependencies, DI container, constructor injection, IHostedService, triggers, AddJob<T>()
34.3.3 Using clustering to add redundancy to your background tasks
This section explains how Quartz.NET persistence and clustering let multiple application instances run scheduled background jobs without executing the same trigger more than once.
- Scaling hazards for background tasks: Explain why independently running IHostedService or BackgroundService instances can duplicate scheduled work when an application is scaled horizontally. Describe the single-worker-service alternative and its limitation when that worker itself needs to scale.
Why it matters: Without coordination, every deployed instance can perform the same background update on its own schedule. - Quartz.NET clustering coordination: Describe how Quartz.NET clustering distributes scheduled job execution across multiple application instances. Explain that schedulers compete for a database lock when a trigger fires, so only one instance executes the associated IJob.
Why it matters: Clustering enables redundant, scalable job-processing instances while preventing duplicate execution of a trigger. - Persistent clustered Quartz configuration: Describe the persistence requirements for enabling Quartz.NET clustering: configure a persistent database store and clustering, and create Quartz.NET's required database tables separately. State that job and trigger descriptions, including when triggers last fired, are stored in the database, and that SQLite can provide persistence but cannot support clustering because it lacks the required locking primitives.
Why it matters: A clustered scheduler only works correctly when its shared persistent store and database schema support the locking it requires.
Key terms: IHostedService, BackgroundService, worker service, horizontal scaling, Quartz.NET clustering, trigger, IJob, scheduler, database lock, backing store
34.4 Summary
This section summarizes how to run background work with hosted services, create headless worker services, and schedule scalable jobs with Quartz.NET.
Concepts explained in this chapter
- background serviceBackgroundService is a .NET abstract base class that provides a standard implementation pattern for long-running hosted background work.
- IHostedServiceIHostedService is a .NET interface for components that start and stop with an application host and perform managed background work.
- workerA worker service is a headless .NET application whose primary function is to run hosted background tasks rather than serve user-facing web endpoints.
- Quartz.NETQuartz.NET is an open-source .NET job-scheduling library that runs tasks according to configured triggers and supports clustered execution.
- computer clusterClustering is a coordination technique in which multiple application instances distribute work so that a task is executed by only one instance.
- Windows serviceA Windows Service is an operating-system-managed application process that can run in the background without an interactive user session.
- triggerA Quartz.NET trigger is a scheduling definition that specifies when and under what repetition rules a job executes.
- systemd daemonA systemd daemon is a Linux background process managed and supervised by the systemd service manager.
- workflow jobA Quartz.NET job is a task whose executable logic is defined by an implementation of IJob.
- background processingA background task is application work that executes independently of direct user interaction, often continuously, periodically, or in response to queued items.
- IJobIJob is the Quartz.NET interface that defines the executable contract for a scheduled job.
- AddHostedServiceAddHostedService is a dependency-injection extension method that registers a hosted-service implementation.
- UseSystemd()AddSystemd() is a .NET host-builder method that configures an application for systemd service integration.
- UseWindowsService()UseWindowsService() is a .NET host-builder method that configures an application to run with Windows Service integration.
- IHostThe generic host is .NET infrastructure for configuring application services, hosting, configuration, logging, and lifetime management independently of a specific application protocol.
- DisallowConcurrentExecutionDisallowConcurrentExecution is a Quartz.NET attribute that prevents overlapping executions of the same job definition.
- job factoryA job factory is a Quartz.NET component that creates instances of scheduled jobs, including by resolving job implementations from a dependency-injection container.
- schedulerA scheduler is the Quartz.NET runtime component that tracks triggers, creates jobs through a job factory, and executes them.
- lockingDatabase locking is a concurrency-control technique that restricts simultaneous access to shared database state.
- ExecuteAsyncExecuteAsync is the method that an IResult implementation uses to write its configured result to an HTTP response.
- StartAsyncStartAsync is an asynchronous host method that starts a configured application and returns when startup processing has completed.
- cachingA cache is local storage of previously retrieved data that allows subsequent requests to reuse the stored response without contacting the origin server.
- Microsoft.Extensions.Hosting.SystemdMicrosoft.Extensions.Hosting.Systemd is a .NET hosting package that integrates applications with systemd on Linux.
- Microsoft.Extensions.Hosting.WindowsServicesMicrosoft.Extensions.Hosting.WindowsServices is a .NET hosting package that integrates applications with the Windows Service system.
- .NET CLIThe .NET CLI is a command-line interface for creating, building, running, and managing .NET applications and projects.
- ConfigureServicesConfigureServices is an ASP.NET Core Startup method that registers and configures application services in the dependency-injection container.
- Host.CreateDefaultBuilder()Host.CreateDefaultBuilder() is a .NET factory method that creates an application host builder with default configuration, logging, environment, and dependency-injection settings.
- IHostBuilderIHostBuilder is a .NET hosting abstraction for configuring an application host before it is built.
- minimal hostingMinimal hosting is an ASP.NET Core application-hosting style that consolidates bootstrapping in an imperative application entry point with reduced convention and builder ceremony.
- projectA project is a .NET unit of deployment containing the source files and configuration needed to build an application or library.
- dbcontextDbContext is the Entity Framework Core base class that coordinates database connections, entity tracking, querying, and persistence for a data model.
- contractA web API is an HTTP-accessible application interface that exposes operations or data to clients.
- bean scopeA scoped lifetime reuses one service instance within a dependency-injection scope and creates different instances for different scopes.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
