GenericHostWebHostBuilderExtensions.ConfigureWebHost Method

Definition

Overloads

ConfigureWebHost(IHostBuilder, Action<IWebHostBuilder>)

Adds and configures an ASP.NET Core web application.

ConfigureWebHost(IHostBuilder, Action<IWebHostBuilder>, Action<WebHostBuilderOptions>)

Adds and configures an ASP.NET Core web application.

ConfigureWebHost(IHostBuilder, Action<IWebHostBuilder>)

Source:
GenericHostWebHostBuilderExtensions.cs

Adds and configures an ASP.NET Core web application.

C#
public static Microsoft.Extensions.Hosting.IHostBuilder ConfigureWebHost (this Microsoft.Extensions.Hosting.IHostBuilder builder, Action<Microsoft.AspNetCore.Hosting.IWebHostBuilder> configure);

Parameters

builder
IHostBuilder

The IHostBuilder to add the IWebHostBuilder to.

configure
Action<IWebHostBuilder>

The delegate that configures the IWebHostBuilder.

Returns

The IHostBuilder.

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

ConfigureWebHost(IHostBuilder, Action<IWebHostBuilder>, Action<WebHostBuilderOptions>)

Source:
GenericHostWebHostBuilderExtensions.cs

Adds and configures an ASP.NET Core web application.

C#
public static Microsoft.Extensions.Hosting.IHostBuilder ConfigureWebHost (this Microsoft.Extensions.Hosting.IHostBuilder builder, Action<Microsoft.AspNetCore.Hosting.IWebHostBuilder> configure, Action<Microsoft.Extensions.Hosting.WebHostBuilderOptions> configureWebHostBuilder);

Parameters

builder
IHostBuilder

The IHostBuilder to add the IWebHostBuilder to.

configure
Action<IWebHostBuilder>

The delegate that configures the IWebHostBuilder.

configureWebHostBuilder
Action<WebHostBuilderOptions>

The delegate that configures the WebHostBuilderOptions.

Returns

The IHostBuilder.

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 5.0, 6.0, 7.0, 8.0, 9.0