WPInfo
WPInfo

Reputation: 1076

Differences and relation between host and server in ASP.net Core

In the Program.cs of an ASP.net Core project, we could use IWebHostBuilder to create(or build) an IWebHost which, I think, is a host.

When creating an IWebHost, we could specify the web server which is Kestrel or HttpSys by using the extension method UseKestrel or UseHttpSys accordingly.

So my question is what the differences and relation between host and web server here in ASP.net Core.

Upvotes: 4

Views: 1089

Answers (1)

Mr Moose
Mr Moose

Reputation: 6344

I'd suggest reviewing the ASP.NET Core fundamentals page which includes the following definitions. I feel the section in italics in the server definition aptly describes the relationship between host and server.

Hosting

ASP.NET Core apps configure and launch a host, which is responsible for app startup and lifetime management.

For more information, see Host in ASP.NET Core.

Servers

The ASP.NET Core hosting model doesn't directly listen for requests. The hosting model relies on an HTTP server implementation to forward the request to the app. The forwarded request is wrapped as a set of feature objects that can be accessed through interfaces. ASP.NET Core includes a managed, cross-platform web server, called Kestrel. Kestrel is often run behind a production web server, such as IIS or Nginx. Kestrel can be run as an edge server.

For more information, see Servers and the following topics:

Kestrel

ASP.NET Core Module

HTTP.sys (formerly called WebListener)

Upvotes: 1

Related Questions