Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
GenericHostBuilderExtensions.ConfigureWebHostDefaults Method
Definition
- Namespace:
- Microsoft.Extensions.Hosting
- Assembly:
- Microsoft.AspNetCore.dll
- Package:
- Microsoft.AspNetCore.App.Ref v10.0.0
- Package:
- Microsoft.AspNetCore.App.Ref v11.0.0-preview.4.26230.115
- Package:
- Microsoft.AspNetCore.App.Ref v3.0.1
- Package:
- Microsoft.AspNetCore.App.Ref v3.1.10
- Package:
- Microsoft.AspNetCore.App.Ref v5.0.0
- Package:
- Microsoft.AspNetCore.App.Ref v6.0.36
- Package:
- Microsoft.AspNetCore.App.Ref v7.0.5
- Package:
- Microsoft.AspNetCore.App.Ref v8.0.19
- Package:
- Microsoft.AspNetCore.App.Ref v9.0.8
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| ConfigureWebHostDefaults(IHostBuilder, Action<IWebHostBuilder>) |
Configures a IHostBuilder with defaults for hosting a web app. This should be called before application specific configuration to avoid it overwriting provided services, configuration sources, environments, content root, etc. |
| ConfigureWebHostDefaults(IHostBuilder, Action<IWebHostBuilder>, Action<WebHostBuilderOptions>) |
Configures a IHostBuilder with defaults for hosting a web app. This should be called before application specific configuration to avoid it overwriting provided services, configuration sources, environments, content root, etc. |
ConfigureWebHostDefaults(IHostBuilder, Action<IWebHostBuilder>)
Configures a IHostBuilder with defaults for hosting a web app. This should be called before application specific configuration to avoid it overwriting provided services, configuration sources, environments, content root, etc.
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
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
ConfigureWebHostDefaults(IHostBuilder, Action<IWebHostBuilder>, Action<WebHostBuilderOptions>)
Configures a IHostBuilder with defaults for hosting a web app. This should be called before application specific configuration to avoid it overwriting provided services, configuration sources, environments, content root, etc.
public static Microsoft.Extensions.Hosting.IHostBuilder ConfigureWebHostDefaults(this Microsoft.Extensions.Hosting.IHostBuilder builder, Action<Microsoft.AspNetCore.Hosting.IWebHostBuilder> configure, Action<Microsoft.Extensions.Hosting.WebHostBuilderOptions> configureOptions);
static member ConfigureWebHostDefaults : Microsoft.Extensions.Hosting.IHostBuilder * Action<Microsoft.AspNetCore.Hosting.IWebHostBuilder> * Action<Microsoft.Extensions.Hosting.WebHostBuilderOptions> -> Microsoft.Extensions.Hosting.IHostBuilder
<Extension()>
Public Function ConfigureWebHostDefaults (builder As IHostBuilder, configure As Action(Of IWebHostBuilder), configureOptions As Action(Of WebHostBuilderOptions)) As IHostBuilder
Parameters
- builder
- IHostBuilder
The IHostBuilder instance to configure.
- configure
- Action<IWebHostBuilder>
The configure callback
- configureOptions
- Action<WebHostBuilderOptions>
The delegate that configures the WebHostBuilderOptions.
Returns
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
Feedback
Was this page helpful?
