HostingAbstractionsWebHostBuilderExtensions Class

Namespace
Microsoft.AspNetCore.Hosting
Assemblies
  • Microsoft.AspNetCore.Hosting.Abstractions

Syntax

public class HostingAbstractionsWebHostBuilderExtensions
class Microsoft.AspNetCore.Hosting.HostingAbstractionsWebHostBuilderExtensions

Methods

CaptureStartupErrors(Microsoft.AspNetCore.Hosting.IWebHostBuilder, System.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.

Arguments:
Return type:

Microsoft.AspNetCore.Hosting.IWebHostBuilder

Returns:

The Microsoft.AspNetCore.Hosting.IWebHostBuilder.

public static IWebHostBuilder CaptureStartupErrors(this IWebHostBuilder hostBuilder, bool captureStartupErrors)
Start(Microsoft.AspNetCore.Hosting.IWebHostBuilder, System.String[])

Start the web host and listen on the speficied urls.

Arguments:
Return type:

Microsoft.AspNetCore.Hosting.IWebHost

Returns:

The Microsoft.AspNetCore.Hosting.IWebHostBuilder.

public static IWebHost Start(this IWebHostBuilder hostBuilder, params string[] urls)
UseConfiguration(Microsoft.AspNetCore.Hosting.IWebHostBuilder, Microsoft.Extensions.Configuration.IConfiguration)

Use the given configuration settings on the web host.

Arguments:
Return type:

Microsoft.AspNetCore.Hosting.IWebHostBuilder

Returns:

The Microsoft.AspNetCore.Hosting.IWebHostBuilder.

public static IWebHostBuilder UseConfiguration(this IWebHostBuilder hostBuilder, IConfiguration configuration)
UseContentRoot(Microsoft.AspNetCore.Hosting.IWebHostBuilder, System.String)

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

Arguments:
Return type:

Microsoft.AspNetCore.Hosting.IWebHostBuilder

Returns:

The Microsoft.AspNetCore.Hosting.IWebHostBuilder.

public static IWebHostBuilder UseContentRoot(this IWebHostBuilder hostBuilder, string contentRoot)
UseEnvironment(Microsoft.AspNetCore.Hosting.IWebHostBuilder, System.String)

Specify the environment to be used by the web host.

Arguments:
Return type:

Microsoft.AspNetCore.Hosting.IWebHostBuilder

Returns:

The Microsoft.AspNetCore.Hosting.IWebHostBuilder.

public static IWebHostBuilder UseEnvironment(this IWebHostBuilder hostBuilder, string environment)
UseServer(Microsoft.AspNetCore.Hosting.IWebHostBuilder, Microsoft.AspNetCore.Hosting.Server.IServer)

Specify the server to be used by the web host.

Arguments:
Return type:

Microsoft.AspNetCore.Hosting.IWebHostBuilder

Returns:

The Microsoft.AspNetCore.Hosting.IWebHostBuilder.

public static IWebHostBuilder UseServer(this IWebHostBuilder hostBuilder, IServer server)
UseStartup(Microsoft.AspNetCore.Hosting.IWebHostBuilder, System.String)

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

Arguments:
Return type:

Microsoft.AspNetCore.Hosting.IWebHostBuilder

Returns:

The Microsoft.AspNetCore.Hosting.IWebHostBuilder.

public static IWebHostBuilder UseStartup(this IWebHostBuilder hostBuilder, string startupAssemblyName)
UseUrls(Microsoft.AspNetCore.Hosting.IWebHostBuilder, System.String[])

Specify the urls the web host will listen on.

Arguments:
Return type:

Microsoft.AspNetCore.Hosting.IWebHostBuilder

Returns:

The Microsoft.AspNetCore.Hosting.IWebHostBuilder.

public static IWebHostBuilder UseUrls(this IWebHostBuilder hostBuilder, params string[] urls)
UseWebRoot(Microsoft.AspNetCore.Hosting.IWebHostBuilder, System.String)

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

Arguments:
Return type:

Microsoft.AspNetCore.Hosting.IWebHostBuilder

Returns:

The Microsoft.AspNetCore.Hosting.IWebHostBuilder.

public static IWebHostBuilder UseWebRoot(this IWebHostBuilder hostBuilder, string webRoot)