BackgroundService Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Base class for implementing a long running IHostedService.
public ref class BackgroundService abstract : IDisposable, Microsoft::Extensions::Hosting::IHostedService
public abstract class BackgroundService : IDisposable, Microsoft.Extensions.Hosting.IHostedService
type BackgroundService = class
interface IHostedService
interface IDisposable
Public MustInherit Class BackgroundService
Implements IDisposable, IHostedService
- Inheritance
-
BackgroundService
- Implements
Background |
Initializes a new instance of the BackgroundService class. |
Execute |
Gets the Task that executes the background operation. |
Dispose() |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
Execute |
This method is called when the IHostedService starts. The implementation should return a task that represents the lifetime of the long running operation(s) being performed. |
Start |
Triggered when the application host is ready to start the service. |
Stop |
Triggered when the application host is performing a graceful shutdown. |
Start |
Starts and immediately stops the service. |
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided) |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided), 2.1 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: