Microsoft.Extensions.Hosting.Abstractions Base class for implementing a long running . Gets the Task that executes the background operation. Will return if the background operation hasn't started. This method is called when the starts. The implementation should return a task that represents the lifetime of the long running operation(s) being performed. Triggered when is called. A that represents the long running operations. See Worker Services in .NET for implementation guidelines. Triggered when the application host is ready to start the service. Indicates that the start process has been aborted. A that represents the asynchronous Start operation. Triggered when the application host is performing a graceful shutdown. Indicates that the shutdown process should no longer be graceful. A that represents the asynchronous Stop operation. Commonly used environment names. This type is obsolete and will be removed in a future version. The recommended alternative is Microsoft.Extensions.Hosting.Environments. The name of the Development environment. The name of the Staging environment. The name of the Production environment. Commonly used environment names. Specifies the Development environment. The development environment can enable features that shouldn't be exposed in production. Because of the performance cost, scope validation and dependency validation only happens in development. Specifies the Staging environment. The staging environment can be used to validate app changes before changing the environment to production. Specifies the Production environment. The production environment should be configured to maximize security, performance, and application robustness. The exception that is thrown when an is stopped to indicate the Host is stopping gracefully. This exception should not be thrown or handled by user code. Initializes a new instance of the class with a system-supplied error message. Initializes a new instance of the class with a specified error message. The error message that explains the reason for the exception. The content of is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. The error message that explains the reason for the exception. The exception that is the cause of the current exception. The content of is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. Context containing the common services on the . Some properties may be null until set by the . Initializes a new instance of . A non-null for sharing state between components during the host building process. The initialized by the . The containing the merged configuration of the application and the . A central location for sharing state between components during the host building process. Constants for HostBuilder configuration keys. The configuration key used to set . The configuration key used to set . The configuration key used to set and . Extension methods for . Checks if the current host environment name is . An instance of . if the environment name is , otherwise . Checks if the current host environment name is . An instance of . if the environment name is , otherwise . Checks if the current host environment name is . An instance of . if the environment name is , otherwise . Compares the current host environment name against the specified value. An instance of . Environment name to validate against. if the specified name is the same as the current environment, otherwise . Provides extension methods for the from the hosting abstractions package. Builds and starts the host. The to start. The started . Builds and starts the host. The to start. A that can be used to cancel the start. The started . Provides extension methods for the from the hosting abstractions package. Starts the host synchronously. The to start. Attempts to gracefully stop the host with the given timeout. The to stop. The timeout for stopping gracefully. Once expired the server may terminate any remaining active connections. The that represents the asynchronous operation. Blocks the calling thread until shutdown is triggered via Ctrl+C or SIGTERM. The running . Runs an application and blocks the calling thread until host shutdown is triggered and all instances are stopped. The to run. Runs an application and returns a that only completes when the token is triggered or shutdown is triggered. The instance is disposed of after running. The to run. The token to trigger shutdown. The that represents the asynchronous operation. Returns a Task that completes when shutdown is triggered via the given token. The running . The token to trigger shutdown. The that represents the asynchronous operation. Extension methods for . Checks if the current hosting environment name is . An instance of . if the environment name is , otherwise . Checks if the current hosting environment name is . An instance of . if the environment name is , otherwise . Checks if the current hosting environment name is . An instance of . if the environment name is , otherwise . Compares the current hosting environment name against the specified value. An instance of . Environment name to validate against. if the specified name is the same as the current environment, otherwise . Allows consumers to perform cleanup during a graceful shutdown. This type is obsolete and will be removed in a future version. The recommended alternative is Microsoft.Extensions.Hosting.IHostApplicationLifetime. Gets a cancellation token. Triggered when the application host has fully started and is about to wait for a graceful shutdown. Gets a cancellation token. Triggered when the application host is performing a graceful shutdown. Requests may still be in flight. Shutdown will block until this event completes. Gets a cancellation token. Triggered when the application host is performing a graceful shutdown. All requests should be complete at this point. Shutdown will block until this event completes. Requests termination of the current application. A program abstraction. Gets the services configured for the program (for example, using ). Starts the objects configured for the program. The application will run until interrupted or until is called. Used to abort program start. A that will be completed when the starts. Attempts to gracefully stop the program. Used to indicate when stop should no longer be graceful. A that will be completed when the stops. Represents a hosted applications and services builder which helps manage configuration, logging, lifetime, and more. Gets a central location for sharing state between components during the host building process. Gets the set of key/value configuration properties. This can be mutated by adding more configuration sources, which will update its current view. Gets the information about the hosting environment an application is running in. Gets a collection of logging providers for the application to compose. This is useful for adding new logging providers. Gets a builder that allows enabling metrics and directing their output. Gets a collection of services for the application to compose. This is useful for adding user provided or framework provided services. Registers a instance to be used to create the . The factory object that can create the and . A delegate used to configure the . This can be used to configure services using APIS specific to the implementation. The type of builder provided by the . The is created when this builder is built and so the delegate provided by will run after all other services have been registered. Multiple calls to will replace the previously stored and delegate. Allows consumers to be notified of application lifetime events. This interface is not intended to be user-replaceable. Gets a cancellation token. Triggered when the application host has fully started. Gets a cancellation token. Triggered when the application host is starting a graceful shutdown. Shutdown will block until all callbacks registered on this token have completed. Gets a cancellation token. Triggered when the application host has completed a graceful shutdown. The application will not exit until all callbacks registered on this token have completed. Requests termination of the current application. A program initialization abstraction. Gets a central location for sharing state between components during the host building process. Sets up the configuration for the builder itself. This will be used to initialize the for use later in the build process. This can be called multiple times and the results will be additive. The delegate for configuring the that will be used to construct the for the host. The same instance of the for chaining. Sets up the configuration for the remainder of the build process and application. This can be called multiple times and the results will be additive. The results will be available at for subsequent operations, as well as in . The delegate for configuring the that will be used to construct the for the application. The same instance of the for chaining. Adds services to the container. This can be called multiple times and the results will be additive. The delegate for configuring the that will be used to construct the . The same instance of the for chaining. Overrides the factory used to create the service provider. The type of builder. The factory to register. The same instance of the for chaining. Overrides the factory used to create the service provider. The type of builder. The factory to register. The same instance of the for chaining. Enables configuring the instantiated dependency container. This can be called multiple times and the results will be additive. The type of builder. The delegate which configures the builder. The same instance of the for chaining. Runs the given actions to initialize the host. This can only be called once. An initialized . Defines methods that are run before or after and . Triggered before . Indicates that the start process has been aborted. A that represents the asynchronous operation. Triggered after . Indicates that the start process has been aborted. A that represents the asynchronous operation. Triggered before . Indicates that the start process has been aborted. A that represents the asynchronous operation. Triggered after . Indicates that the stop process has been aborted. A that represents the asynchronous operation. Defines methods for objects that are managed by the host. Triggered when the application host is ready to start the service. Indicates that the start process has been aborted. A that represents the asynchronous Start operation. Triggered when the application host is performing a graceful shutdown. Indicates that the shutdown process should no longer be graceful. A that represents the asynchronous Stop operation. Provides information about the hosting environment an application is running in. Gets or sets the name of the environment. The host automatically sets this property to the value of the "environment" key as specified in configuration. Gets or sets the name of the application. This property is automatically set by the host to the assembly containing the application entry point. Gets or sets the absolute path to the directory that contains the application content files. Gets or sets an pointing at . Provides information about the hosting environment an application is running in. This type is obsolete and will be removed in a future version. The recommended alternative is Microsoft.Extensions.Hosting.IHostEnvironment. Gets or sets the name of the environment. The host automatically sets this property to the value of the of the "environment" key as specified in configuration. Gets or sets the name of the application. This property is automatically set by the host to the assembly containing the application entry point. Gets or sets the absolute path to the directory that contains the application content files. Gets or sets an pointing at . Tracks host lifetime. Called at the start of which will wait until it's complete before continuing. This can be used to delay startup until signaled by an external event. Used to abort program start. A . Called from to indicate that the host is stopping and it's time to shut down. Used to indicate when stop should no longer be graceful. A . Extension methods for adding hosted services to an . Add an registration for the given type. An to register. The to register with. The original . Add an registration for the given type. An to register. The to register with. A factory to create new instances of the service implementation. The original . Indicates that certain members on a specified are accessed dynamically, for example through . This allows tools to understand which members are being accessed during the execution of a program. This attribute is valid on members whose type is or . When this attribute is applied to a location of type , the assumption is that the string represents a fully qualified type name. When this attribute is applied to a class, interface, or struct, the members specified can be accessed dynamically on instances returned from calling on instances of that class, interface, or struct. If the attribute is applied to a method it's treated as a special case and it implies the attribute should be applied to the "this" parameter of the method. As such the attribute should only be used on instance methods of types assignable to System.Type (or string, but no methods will use it there). Initializes a new instance of the class with the specified member types. The types of members dynamically accessed. Gets the which specifies the type of members dynamically accessed. Specifies the types of members that are dynamically accessed. This enumeration has a attribute that allows a bitwise combination of its member values. Specifies no members. Specifies the default, parameterless public constructor. Specifies all public constructors. Specifies all non-public constructors. Specifies all public methods. Specifies all non-public methods. Specifies all public fields. Specifies all non-public fields. Specifies all public nested types. Specifies all non-public nested types. Specifies all public properties. Specifies all non-public properties. Specifies all public events. Specifies all non-public events. Specifies all interfaces implemented by the type. Specifies all non-public constructors, including those inherited from base classes. Specifies all non-public methods, including those inherited from base classes. Specifies all non-public fields, including those inherited from base classes. Specifies all non-public nested types, including those inherited from base classes. Specifies all non-public properties, including those inherited from base classes. Specifies all non-public events, including those inherited from base classes. Specifies all public constructors, including those inherited from base classes. Specifies all public nested types, including those inherited from base classes. Specifies all constructors, including those inherited from base classes. Specifies all methods, including those inherited from base classes. Specifies all fields, including those inherited from base classes. Specifies all nested types, including those inherited from base classes. Specifies all properties, including those inherited from base classes. Specifies all events, including those inherited from base classes. Specifies all members. Specifies that null is allowed as an input even if the corresponding type disallows it. Specifies that null is disallowed as an input even if the corresponding type allows it. Specifies that an output may be null even if the corresponding type disallows it. Specifies that an output will not be null even if the corresponding type allows it. Specifies that an input argument was not null when the call returns. Specifies that when a method returns , the parameter may be null even if the corresponding type disallows it. Initializes the attribute with the specified return value condition. The return value condition. If the method returns this value, the associated parameter may be null. Gets the return value condition. Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it. Initializes the attribute with the specified return value condition. The return value condition. If the method returns this value, the associated parameter will not be null. Gets the return value condition. Specifies that the output will be non-null if the named parameter is non-null. Initializes the attribute with the associated parameter name. The associated parameter name. The output will be non-null if the argument to the parameter specified is non-null. Gets the associated parameter name. Applied to a method that will never return under any circumstance. Specifies that the method will not return if the associated Boolean parameter is passed the specified value. Initializes the attribute with the specified parameter value. The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument to the associated parameter matches this value. Gets the condition parameter value. Specifies that the method or property will ensure that the listed field and property members have not-null values. Initializes the attribute with a field or property member. The field or property member that is promised to be not-null. Initializes the attribute with the list of field and property members. The list of field and property members that are promised to be not-null. Gets field or property member names. Specifies that the method or property will ensure that the listed field and property members have not-null values when returning with the specified return value condition. Initializes the attribute with the specified return value condition and a field or property member. The return value condition. If the method returns this value, the associated field or property member will not be null. The field or property member that is promised to be not-null. Initializes the attribute with the specified return value condition and list of field and property members. The return value condition. If the method returns this value, the associated field and property members will not be null. The list of field and property members that are promised to be not-null. Gets the return value condition. Gets field or property member names. When applied to an attribute class, instructs the compiler to flow applications of that attribute, from source code down to compiler-generated symbols. This can help IL-based analysis tools. One example where this attribute applies is in C# primary constructor parameters. If an attribute marked with gets applied to a primary constructor parameter, the attribute will also be applied to any compiler-generated fields storing that parameter. Initializes a new instance of the class. Attribute used to indicate a source generator should create a function for marshalling arguments instead of relying on the runtime to generate an equivalent marshalling function at run-time. This attribute is meaningless if the source generator associated with it is not enabled. The current built-in source generator only supports C# and only supplies an implementation when applied to static, partial, non-generic methods. Initializes a new instance of the . Name of the library containing the import. Gets the name of the library containing the import. Gets or sets the name of the entry point to be called. Gets or sets how to marshal string arguments to the method. If this field is set to a value other than , must not be specified. Gets or sets the used to control how string arguments to the method are marshalled. If this field is specified, must not be specified or must be set to . Gets or sets whether the callee sets an error (SetLastError on Windows or errno on other platforms) before returning from the attributed method. Specifies how strings should be marshalled for generated p/invokes Indicates the user is supplying a specific marshaller in . Use the platform-provided UTF-8 marshaller. Use the platform-provided UTF-16 marshaller. The host was aborted. Provides downlevel polyfills for static methods on Exception-derived types.