Class HostedWebAppBuilder
Hosted WebApplication builder.
public sealed class HostedWebAppBuilder : BaseHostedAppBuilder, IHostedWebAppBuilder, IHostApplicationBuilder
- Inheritance
-
HostedWebAppBuilder
- Implements
- Extension Methods
Remarks
The typical main entry poitn of a web application could look like this:
public static async Task Main(string[] args) {
var webAppBuilder= new HostedWebAppBuilder(args);
/* As an advanced option one could apply additional custom configuration
* that has not already been applied through the appsettings configuration
* -> right here <-
*/
var webApp= webAppBuilder.Build();
/*
* Additional API end-points could be programatically declared like:
* webApp.MapGet("/hello", () => "Hello, world!");
*/
await webApp.RunAsync();
}
Constructors
HostedWebAppBuilder(string, string, string[]?)
Ctor from optional hostSectionName
, middlewareSectionName
and optional args
.
public HostedWebAppBuilder(string hostSectionName, string middlewareSectionName, string[]? args = null)
Parameters
HostedWebAppBuilder(string[]?)
Ctor from optional args
.
public HostedWebAppBuilder(string[]? args = null)
Parameters
args
string[]
Properties
Host
IHostBuilder implementation for programatic configuration.
public ConfigureHostBuilder Host { get; }
Property Value
WebHost
IWebHostBuilder implementation for programatic configuration.
public ConfigureWebHostBuilder WebHost { get; }
Property Value
Methods
Build()
Builds the WebApplication.
public WebApplication Build()