BackgroundService BackgroundService BackgroundService BackgroundService Class


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


BackgroundService() BackgroundService() BackgroundService() BackgroundService()


Dispose() Dispose() Dispose() Dispose()
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
ExecuteAsync(CancellationToken) ExecuteAsync(CancellationToken) ExecuteAsync(CancellationToken) ExecuteAsync(CancellationToken)

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.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
StartAsync(CancellationToken) StartAsync(CancellationToken) StartAsync(CancellationToken) StartAsync(CancellationToken)

Triggered when the application host is ready to start the service.

StopAsync(CancellationToken) StopAsync(CancellationToken) StopAsync(CancellationToken) StopAsync(CancellationToken)

Triggered when the application host is performing a graceful shutdown.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to