// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Threading; using System.Threading.Tasks; namespace Microsoft.Extensions.Hosting { /// /// Defines methods for objects that are managed by the host. /// public interface IHostedService { /// /// Triggered when the application host is ready to start the service. /// /// Indicates that the start process has been aborted. Task StartAsync(CancellationToken cancellationToken); /// /// Triggered when the application host is performing a graceful shutdown. /// /// Indicates that the shutdown process should no longer be graceful. Task StopAsync(CancellationToken cancellationToken); } }