12 Understanding the ASP.NET Core platform

 

This chapter covers

  • Understanding the basic structure of an ASP. NET Core application
  • Understanding the HTTP request processing pipeline and middleware components
  • Creating custom middleware components

The ASP.NET Core platform is the foundation for creating web applications; it provides the features that make it possible to use frameworks like MVC and Blazor. In this chapter, I explain how the basic ASP.NET Core features work, describe the purpose of the files in an ASP.NET Core project, and explain how the ASP.NET Core request pipeline is used to process HTTP requests and demonstrate the different ways that it can be customized.

Don’t worry if not everything in this chapter makes immediate sense or appears to apply to the applications you intend to create. The features I describe in this chapter are the underpinnings for everything that ASP.NET Core does, and understanding how they work helps provide a context for understanding the features that you will use daily, as well as giving you the knowledge you need to diagnose problems when you don’t get the behavior you expect. Table 12.1 puts the ASP.NET Core platform in context.

12.1 Preparing for this chapter

12.1.1 Running the example application

12.2 Understanding the ASP.NET Core platform

12.2.1 Understanding middleware and the request pipeline

12.2.2 Understanding services

12.3 Understanding the ASP.NET Core project

12.3.1 Understanding the entry point

12.3.2 Understanding the project file

12.4 Creating custom middleware

12.4.1 Defining middleware using a class

12.4.2 Understanding the return pipeline path

12.4.3 Short-Circuiting the request pipeline

12.4.4 Creating pipeline branches

12.4.5 Creating terminal middleware

12.5 Configuring middleware

12.5.1 Using the options pattern with class-based middleware

Summary