Sunday, February 10, 2019

Asp.Net Core Host and Logging Configuration

A simple Asp.Net core application contains a Startup.cs file and a Program.cs file. We saw that the Startup file is used to define the execution pipeline to process Http requests and to inject services. In this post we shall see about the role of Program.cs file.

The Program.cs file in an Asp.Net core application contains logic to define the host configuration and logging configuration. It has the public static void Main() method which is the entry point of the application.

The Main() method calls CreateWebHostBuilder, which in-turn calls WebHost.CreateDefaultBuilder, this method performs the following tasks under the hood.

Asp.Net Core Startup Configuration

Startup configuration for Asp.Net Core applications are defined in a startup file Startup.cs. This is similar to the global.aspx.cs file in the previous version of Asp.Net. Startup settings are important in Asp.Net Core since we need to define the execution pipeline during startup to handle all incoming requests.

There are 2 important methods in the Startup which define the execution sequence of Asp.Net core request execution.

Configure
ConfigureServices

Monday, February 4, 2019

Advantages of Asp.Net Core

Asp.Net core is a light weight, cross-platform compatible web development framework from Microsoft. Asp.Net core can be considered as the next generation web development framework from Microsoft, Asp.Net for long has been windows centric, for the first time Asp.Net core has made web application development possible in multiple platforms. The other key improvement in Asp.Net core is that it can produce light weight applications with higher performance compared to the previous version of Asp.Net. Let us look into some of the advantages of Asp.Net core in detail.

What is Asp.Net Core

Asp.Net core is a new web development framework from Microsoft providing cross platform compatibility. The previous version of Asp.Net could be developed in Windows and deployed in IIS. Asp.Net core changes this, Asp.Net core applications can be developed in Windows, Linux or Mac OS.

Asp.Net core also aims in producing leaner light weight applications compared to traditional Asp.Net applications. Asp.Net core provides more flexibility in the way we design our applications, it allows us to chain a set of Middle-ware's to process the Http request.

Each middle-ware performs a specific task and passes on the result to the next Middle-ware in the chain. Each piece of middle-ware in ASP.NET Core is an object, and each piece has a very specific, focused, and limited role.