Migrating Inprocess Background Jobs

Ports background jobs from ASP.NET Framework to ASP.NET Core and the .NET Generic Host, and stops a job running twice while the legacy and new hosts are both live. Use when an app uses WebBackgrounder (JobManager, IJob, IJobCoordinator, WebFarmJobCoordinator), HostingEnvironment.QueueBackgroundWorkItem, IRegisteredObject or HostingEnvironment.RegisterObject, timers or Task.Run loops started from Application_Start, WebActivatorEx or OWIN Startup, or console job runners whose Main loops and sleeps or runs once per external trigger. Covers BackgroundService, IHostedService, Channel<T> work queues, Generic Host and Worker Service console jobs, shutdown and failure behaviour, and a duplicate-execution guard for side-by-side migration: a shared SQL schedule row or an Azure blob lease that both hosts take, fencing tokens, and handover. Triggers for "background job", "scheduled job", "hosted service", "job runs twice", "double fire", "leader election", "distributed lock", or "singleton job".

Microsoft Updated 195k repo stars
image

File contents

microsoft/upgrade-agent-plugins commit cdb52ecddb

Frequently asked questions

npx get-skill add microsoft/migrating-inprocess-background-jobs