Call out special builder method names (#12384)

pull/12385/head
Luke Latham 2019-05-11 11:51:33 -05:00 committed by Rick Anderson
parent b8675a092a
commit 4564998091
2 changed files with 9 additions and 3 deletions

View File

@ -4,7 +4,7 @@ author: guardrex
description: Learn about Web Host in ASP.NET Core, which is responsible for app startup and lifetime management.
ms.author: riande
ms.custom: mvc
ms.date: 12/18/2018
ms.date: 05/11/2019
uid: fundamentals/host/web-host
---
# ASP.NET Core Web Host
@ -33,7 +33,9 @@ This article covers the ASP.NET Core Web Host ([IWebHostBuilder](/dotnet/api/mic
## Set up a host
Create a host using an instance of [IWebHostBuilder](/dotnet/api/microsoft.aspnetcore.hosting.iwebhostbuilder). This is typically performed in the app's entry point, the `Main` method. In the project templates, `Main` is located in *Program.cs*. A typical *Program.cs* calls [CreateDefaultBuilder](/dotnet/api/microsoft.aspnetcore.webhost.createdefaultbuilder) to start setting up a host:
Create a host using an instance of [IWebHostBuilder](/dotnet/api/microsoft.aspnetcore.hosting.iwebhostbuilder). This is typically performed in the app's entry point, the `Main` method. The builder method name, `CreateWebHostBuilder`, is special name that identifies the builder method to external components, such as [Entity Framework](/ef/core/).
In the project templates, `Main` is located in *Program.cs*. A typical app calls [CreateDefaultBuilder](/dotnet/api/microsoft.aspnetcore.webhost.createdefaultbuilder) to start setting up a host:
```csharp
public class Program

View File

@ -5,7 +5,7 @@ description: Learn the foundational concepts for building ASP.NET Core apps.
monikerRange: '>= aspnetcore-2.1'
ms.author: riande
ms.custom: mvc
ms.date: 03/31/2019
ms.date: 05/11/2019
uid: fundamentals/index
---
# ASP.NET Core fundamentals
@ -72,6 +72,8 @@ The code to create a host is in `Program.Main` and follows the [builder pattern]
::: moniker range=">= aspnetcore-3.0"
`CreateHostBuilder` is special name that identifies the builder method to external components, such as [Entity Framework](/ef/core/).
In ASP.NET Core 3.0 or later, Generic Host (`Host` class) or Web Host (`WebHost` class) can be used in a web app. Generic Host is recommended, and Web Host is available for backwards compatibility.
The framework provides the `CreateDefaultBuilder` and `ConfigureWebHostDefaults` methods to set up a host with commonly used options, such as the following:
@ -90,6 +92,8 @@ For more information, see <xref:fundamentals/host/generic-host> and <xref:fundam
::: moniker range="< aspnetcore-3.0"
`CreateWebHostBuilder` is special name that identifies the builder method to external components, such as [Entity Framework](/ef/core/).
ASP.NET Core 2.x uses Web Host (`WebHost` class) for web apps. The framework provides `CreateDefaultBuilder` to set up a host with commonly used options, such as the following:
* Use [Kestrel](#servers) as the web server and enable IIS integration.