HostingHostBuilderExtensions 類別

定義

public ref class HostingHostBuilderExtensions abstract sealed
public static class HostingHostBuilderExtensions
type HostingHostBuilderExtensions = class
Public Module HostingHostBuilderExtensions
繼承
HostingHostBuilderExtensions

方法

ConfigureAppConfiguration(IHostBuilder, Action<IConfigurationBuilder>)

設定其餘組建流程和應用程式的組態。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. 這些結果可用於後續作業的 Configuration,以及 ServicesThe results will be available at Configuration for subsequent operations, as well as in Services.

ConfigureContainer<TContainerBuilder>(IHostBuilder, Action<TContainerBuilder>)

能夠設定具現化的相依性容器。Enables configuring the instantiated dependency container. 這可以呼叫多次,結果會進行累加。This can be called multiple times and the results will be additive.

ConfigureLogging(IHostBuilder, Action<HostBuilderContext,ILoggingBuilder>)

新增用於設定所提供 ILoggingBuilder 的委派。Adds a delegate for configuring the provided ILoggingBuilder. 可能會多次呼叫此項。This may be called multiple times.

ConfigureLogging(IHostBuilder, Action<ILoggingBuilder>)

新增用於設定所提供 ILoggingBuilder 的委派。Adds a delegate for configuring the provided ILoggingBuilder. 可能會多次呼叫此項。This may be called multiple times.

ConfigureServices(IHostBuilder, Action<IServiceCollection>)

將服務新增至容器。Adds services to the container. 這可以呼叫多次,結果會進行累加。This can be called multiple times and the results will be additive.

RunConsoleAsync(IHostBuilder, Action<ConsoleLifetimeOptions>, CancellationToken)

啟用主控台支援、建置和啟動主機,以及等候 Ctrl+C 或 SIGTERM 關機。Enables console support, builds and starts the host, and waits for Ctrl+C or SIGTERM to shut down.

RunConsoleAsync(IHostBuilder, CancellationToken)

啟用主控台支援、建置和啟動主機,以及等候 Ctrl+C 或 SIGTERM 關機。Enables console support, builds and starts the host, and waits for Ctrl+C or SIGTERM to shut down.

UseConsoleLifetime(IHostBuilder)

接聽 Ctrl+C 或 SIGTERM,並呼叫 StopApplication() 以啟動關機流程。Listens for Ctrl+C or SIGTERM and calls StopApplication() to start the shutdown process. 這會解除封鎖 RunAsync 和 WaitForShutdownAsync 等延伸模組。This will unblock extensions like RunAsync and WaitForShutdownAsync.

UseConsoleLifetime(IHostBuilder, Action<ConsoleLifetimeOptions>)

接聽 Ctrl+C 或 SIGTERM,並呼叫 StopApplication() 以啟動關機流程。Listens for Ctrl+C or SIGTERM and calls StopApplication() to start the shutdown process. 這會解除封鎖 RunAsync 和 WaitForShutdownAsync 等延伸模組。This will unblock extensions like RunAsync and WaitForShutdownAsync.

UseContentRoot(IHostBuilder, String)

指定主機要使用的內容根目錄。Specify the content root directory to be used by the host.

UseDefaultServiceProvider(IHostBuilder, Action<HostBuilderContext,ServiceProviderOptions>)

IServiceProvider 指定為預設值。Specify the IServiceProvider to be the default one.

UseDefaultServiceProvider(IHostBuilder, Action<ServiceProviderOptions>)

IServiceProvider 指定為預設值。Specify the IServiceProvider to be the default one.

UseEnvironment(IHostBuilder, String)

指定主機要使用的環境。Specify the environment to be used by the host.

適用於