GenericHostBuilderExtensions.ConfigureWebHostDefaults(IHostBuilder, Action<IWebHostBuilder>) Method

Definition

Configures a IHostBuilder with defaults for hosting a web app.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Hosting::IHostBuilder ^ ConfigureWebHostDefaults(Microsoft::Extensions::Hosting::IHostBuilder ^ builder, Action<Microsoft::AspNetCore::Hosting::IWebHostBuilder ^> ^ configure);
public static Microsoft.Extensions.Hosting.IHostBuilder ConfigureWebHostDefaults (this Microsoft.Extensions.Hosting.IHostBuilder builder, Action<Microsoft.AspNetCore.Hosting.IWebHostBuilder> configure);
static member ConfigureWebHostDefaults : Microsoft.Extensions.Hosting.IHostBuilder * Action<Microsoft.AspNetCore.Hosting.IWebHostBuilder> -> Microsoft.Extensions.Hosting.IHostBuilder
<Extension()>
Public Function ConfigureWebHostDefaults (builder As IHostBuilder, configure As Action(Of IWebHostBuilder)) As IHostBuilder

Parameters

builder
IHostBuilder

The IHostBuilder instance to configure.

configure
Action<IWebHostBuilder>

The configure callback

Returns

IHostBuilder

A reference to the builder after the operation has completed.

Remarks

The following defaults are applied to the IHostBuilder:

  • use Kestrel as the web server and configure it using the application's configuration providers
  • configure WebRootFileProvider to include static web assets from projects referenced by the entry assembly during development
  • adds the HostFiltering middleware
  • adds the ForwardedHeaders middleware if ASPNETCORE_FORWARDEDHEADERS_ENABLED=true,
  • enable IIS integration

Applies to