Please enable Javascript for better experience...
Getting started to .Net Core (Introduction)
By AshokGupta | Jul 7, 2020 | In Articles | Total Views [ 2475 ]
Taged In
(2 Like)
Rate

ASP.NET Core is an open source and cloud-optimized web framework for developing modern web applications that can be developed and run on Windows, Linux and the Mac. It includes the MVC framework, which now combines the features of MVC and Web API into a single web programming framework.

Advantages of ASP.NET Core

ASP.NET Core comes with the following advantages:

  • ASP.NET Core is no longer based on System.Web.dll. It is based on a set of granular and well factored NuGet packages.
  • This allows you to optimize your app to include just the NuGet packages you need.
  • The benefits of a smaller app surface area include tighter security, reduced servicing, improved performance, and decreased costs

 

With ASP.NET Core, you can get the following improvements:

  • Build and run Cross-Platform ASP.NET apps on Windows, Mac and Linux
  • Built on .NET Core, which supports true side-by-side app versioning
  • New tooling that simplifies modern web development
  • Built-in support for Dependency Injection
  • Tag Helpers which makes Razor markup more natural with HTML
  • Ability to host on IIS or self-host in your own process

Steps to initiate .Net Core application

Once you have installed the Visual Studio 2015 tooling, you can start building a new ASP.NET Core Application from the File > New Project menu option.

image 1

On the New Project dialog box, you will see the following three different templates for Web projects:

  • ASP.NET Web Application: The simple ASP.NET application templates
  • ASP.NET Core Web Application (.NET Core): This will start you with a crossplatform compatible project that runs on the .NET Core framework
  • ASP.NET Core Web Application (.NET Framework): This starts a new project that

Runs on the standard .NET Framework on Windows.

 

In the left pane, select Templates > Visual C# > Web and in the middle pane select the ASP.NET Core Web Application (.NET Core) template. Let us call this application FirstAppDemo and also specify the Location for your ASP.NET Core project and then Click OK.

image 2

Here, we will start with an empty template. This would help us build it from scratch. Let us select the Empty template, turn off the Host in the cloud and click OK.

image 3

FirstAppDemo.sln is a solution file. Visual Studio has used this extension for years by default, and you can double-click on the file if you want to open the app in Studio and work on it. There is also a global.json file. Let us open this file in Visual Studio.

Globalization and localization in ASP.NET Core

Globalization is the process of designing apps that support different cultures. Globalization adds support for input, display and output of a defined set of language scripts that relate to specific geographic areas.

Localization is the process of adapting a globalized app, which you have already processed for localizability, to a particular culture/locale

ASP.NET Core Middleware

Middleware is software that's assembled into an app pipeline to handle requests and responses. Each component:

  • Chooses whether to pass the request to the next component in the pipeline.
  • Can perform work before and after the next component in the pipeline.

Request delegates are used to build the request pipeline. The request delegates handle each HTTP request.

Request delegates are configured using Run, Map, and Use extension methods. An individual request delegate can be specified in-line as an anonymous method (called in-line middleware), or it can be defined in a reusable class. These reusable classes and in-line anonymous methods are middleware, also called middleware components. Each middleware component in the request pipeline is responsible for invoking the next component in the pipeline or short-circuiting the pipeline. When a middleware short-circuits, it's called a terminal middleware because it prevents further middleware from processing the request.

Run Delegate: Adds a terminal middleware delegate to the application's request pipeline.

Map Delegate: Will Update Soon

Use Delegate: Will Update Soon

Create a middleware pipeline with IApplicationBuilder

The ASP.NET Core request pipeline consists of a sequence of request delegates, called one after the other. The following diagram demonstrates the concept. The thread of execution follows the black arrows.

 image 5

Middleware order:

The following diagram shows the complete request processing pipeline for ASP.NET Core MVC and Razor Pages apps. You can see how, in a typical app, existing middlewares are ordered and where custom middlewares are added. You have full control over how to reorder existing middlewares or inject new custom middlewares as necessary for your scenarios.

image6

image7

Hope it helps you.

Share this

About the Author

AshokGupta
AshokGupta
Member dotnet-concept.com

Public profile: user/profile/99907160


Senior Software Developer at NIIT Technologies Pvt. Ltd.

User's Comments


 
Please SignUp/Login to comment...

Or comment as anonymous...
* Name
* Email ID
Comment
 
 
 
 
 
 
Sponsors