Start here. This is the direct spoken answer to practice first.
Why this question matters
The orchestrator normally sends a termination signal and allows a grace period before force-killing the process. The service should stop accepting new work, cancel or finish bounded work, and exit within that deadline.
ASP.NET Core's host responds to the shutdown signal and exposes cancellation to hosted services. I mark the instance unready, let in-flight requests drain within a configured timeout, and pass stopping tokens through queue waits, database calls, and HTTP calls. Background workers stop claiming new jobs first. A job that cannot finish safely should preserve a checkpoint or return to a durable queue rather than blocking shutdown indefinitely.