IWebHostBuilder Interface

Definition

A builder for IWebHost.

public interface class IWebHostBuilder
public interface IWebHostBuilder
type IWebHostBuilder = interface
Public Interface IWebHostBuilder
Derived

Methods

Build()

Builds an IWebHost which hosts a web application.

ConfigureAppConfiguration(Action<WebHostBuilderContext,IConfigurationBuilder>)

Adds a delegate for configuring the IConfigurationBuilder that will construct an IConfiguration.

ConfigureLogging(Action<ILoggerFactory>)

Adds a delegate for configuring the provided ILoggerFactory. This may be called multiple times.

ConfigureServices(Action<IServiceCollection>)

Adds a delegate for configuring additional services for the host or web application. This may be called multiple times.

ConfigureServices(Action<WebHostBuilderContext,IServiceCollection>)

Adds a delegate for configuring additional services for the host or web application. This may be called multiple times.

GetSetting(String)

Get the setting value from the configuration.

UseLoggerFactory(ILoggerFactory)

Specify the ILoggerFactory to be used by the web host.

UseSetting(String, String)

Add or replace a setting in the configuration.

Extension Methods

UseAzureAppServices(IWebHostBuilder)

Configures application to use Azure AppServices integration.

CaptureStartupErrors(IWebHostBuilder, Boolean)

Set whether startup errors should be captured in the configuration settings of the web host. When enabled, startup exceptions will be caught and an error page will be returned. If disabled, startup exceptions will be propagated.

PreferHostingUrls(IWebHostBuilder, Boolean)

Indicate whether the host should listen on the URLs configured on the IWebHostBuilder instead of those configured on the IServer.

Start(IWebHostBuilder, String[])

Start the web host and listen on the specified urls.

SuppressStatusMessages(IWebHostBuilder, Boolean)

Specify if startup status messages should be suppressed.

UseConfiguration(IWebHostBuilder, IConfiguration)

Use the given configuration settings on the web host.

UseContentRoot(IWebHostBuilder, String)

Specify the content root directory to be used by the web host.

UseEnvironment(IWebHostBuilder, String)

Specify the environment to be used by the web host.

UseServer(IWebHostBuilder, IServer)

Specify the server to be used by the web host.

UseShutdownTimeout(IWebHostBuilder, TimeSpan)

Specify the amount of time to wait for the web host to shutdown.

UseStartup(IWebHostBuilder, String)

Specify the assembly containing the startup type to be used by the web host.

UseUrls(IWebHostBuilder, String[])

Specify the urls the web host will listen on.

UseWebRoot(IWebHostBuilder, String)

Specify the webroot directory to be used by the web host.

ListenHttpOnAnyPort(IWebHostBuilder)

Adds Kestrel server instance listening on the given HTTP port.

ListenHttpsOnAnyPort(IWebHostBuilder, X509Certificate2)

Adds Kestrel server instance listening on a random HTTPS port.

UseFakeStartup(IWebHostBuilder)

Adds an empty Startup class to satisfy ASP.NET check.

Configure(IWebHostBuilder, Action<IApplicationBuilder>)

Specify the startup method to be used to configure the web application.

Configure(IWebHostBuilder, Action<WebHostBuilderContext,IApplicationBuilder>)

Specify the startup method to be used to configure the web application.

ConfigureAppConfiguration(IWebHostBuilder, Action<IConfigurationBuilder>)

Adds a delegate for configuring the IConfigurationBuilder that will construct an IConfiguration.

ConfigureLogging(IWebHostBuilder, Action<WebHostBuilderContext,ILoggingBuilder>)

Adds a delegate for configuring the provided LoggerFactory. This may be called multiple times.

ConfigureLogging(IWebHostBuilder, Action<ILoggingBuilder>)

Adds a delegate for configuring the provided ILoggingBuilder. This may be called multiple times.

UseDefaultServiceProvider(IWebHostBuilder, Action<WebHostBuilderContext,ServiceProviderOptions>)

Configures the default service provider

UseDefaultServiceProvider(IWebHostBuilder, Action<ServiceProviderOptions>)

Configures the default service provider

UseStartup(IWebHostBuilder, Type)

Specify the startup type to be used by the web host.

UseStartup<TStartup>(IWebHostBuilder)

Specify the startup type to be used by the web host.

UseStartup<TStartup>(IWebHostBuilder, Func<WebHostBuilderContext,TStartup>)

Specify a factory that creates the startup instance to be used by the web host.

UseStaticWebAssets(IWebHostBuilder)

Configures the WebRootFileProvider to use static web assets defined by referenced projects and packages.

UseHttpSys(IWebHostBuilder)

Specify Http.sys as the server to be used by the web host.

UseHttpSys(IWebHostBuilder, Action<HttpSysOptions>)

Specify Http.sys as the server to be used by the web host.

UseIIS(IWebHostBuilder)

Configures the port and base path the server should listen on when running behind AspNetCoreModule. The app will also be configured to capture startup errors.

UseIISIntegration(IWebHostBuilder)

Configures the port and base path the server should listen on when running behind AspNetCoreModule. The app will also be configured to capture startup errors.

ConfigureKestrel(IWebHostBuilder, Action<WebHostBuilderContext,KestrelServerOptions>)

Configures Kestrel options but does not register an IServer. See UseKestrel(IWebHostBuilder).

ConfigureKestrel(IWebHostBuilder, Action<KestrelServerOptions>)

Configures Kestrel options but does not register an IServer. See UseKestrel(IWebHostBuilder).

UseKestrel(IWebHostBuilder)

Specify Kestrel as the server to be used by the web host.

UseKestrel(IWebHostBuilder, Action<WebHostBuilderContext,KestrelServerOptions>)

Specify Kestrel as the server to be used by the web host.

UseKestrel(IWebHostBuilder, Action<KestrelServerOptions>)

Specify Kestrel as the server to be used by the web host.

UseKestrel(IWebHostBuilder, Action<KestrelServerOptions>)

Specify Kestrel as the server to be used by the web host.

UseKestrelCore(IWebHostBuilder)

Specify Kestrel as the server to be used by the web host. Includes less automatic functionality than UseKestrel(IWebHostBuilder) to make trimming more effective (e.g. for Native AOT scenarios). If the host ends up depending on some of the absent functionality, a best-effort attempt will be made to enable it on-demand. Failing that, an exception with an informative error message will be raised when the host is started.

UseKestrelHttpsConfiguration(IWebHostBuilder)

In UseKestrelCore(IWebHostBuilder) scenarios, it may be necessary to explicitly opt in to certain HTTPS functionality. For example, if ASPNETCORE_URLS includes an https:// address, UseKestrelHttpsConfiguration(IWebHostBuilder) will enable configuration of HTTPS on that endpoint.

Has no effect in UseKestrel(IWebHostBuilder) scenarios.

UseLibuv(IWebHostBuilder)
Obsolete.

Specify Libuv as the transport to be used by Kestrel.

UseLibuv(IWebHostBuilder, Action<LibuvTransportOptions>)
Obsolete.

Specify Libuv as the transport to be used by Kestrel.

UseQuic(IWebHostBuilder)
UseQuic(IWebHostBuilder, Action<QuicTransportOptions>)
UseNamedPipes(IWebHostBuilder)

Specify Named Pipes as the transport to be used by Kestrel.

UseNamedPipes(IWebHostBuilder, Action<NamedPipeTransportOptions>)

Specify Named Pipes as the transport to be used by Kestrel.

UseQuic(IWebHostBuilder)

Specify Quic as the transport to be used by Kestrel.

UseQuic(IWebHostBuilder, Action<QuicTransportOptions>)

Specify Quic as the transport to be used by Kestrel.

UseSockets(IWebHostBuilder)

Specify Sockets as the transport to be used by Kestrel.

UseSockets(IWebHostBuilder, Action<SocketTransportOptions>)

Specify Sockets as the transport to be used by Kestrel.

UseWebListener(IWebHostBuilder)

Specify WebListener as the server to be used by the web host.

UseWebListener(IWebHostBuilder, Action<WebListenerOptions>)

Specify WebListener as the server to be used by the web host.

ConfigureTestContainer<TContainer>(IWebHostBuilder, Action<TContainer>)

Configures the IWebHostBuilder instance with the services provided in servicesConfiguration.

ConfigureTestServices(IWebHostBuilder, Action<IServiceCollection>)

Configures the IWebHostBuilder instance with the services provided in servicesConfiguration.

UseSolutionRelativeContentRoot(IWebHostBuilder, String, String)

Sets the content root of relative to the solutionRelativePath.

UseSolutionRelativeContentRoot(IWebHostBuilder, String, String, String)

Sets the content root of relative to the solutionRelativePath.

UseTestServer(IWebHostBuilder)

Enables the TestServer service.

UseTestServer(IWebHostBuilder, Action<TestServerOptions>)

Enables the TestServer service.

Applies to