ASP.NET Core is Microsoft’s cross-platform, open-source web framework for building dynamic applications and services on .NET. It supplies common web infrastructure so you can focus on application behavior instead of writing networking and framework code from scratch. section 1.1 section 2.1
Framework code handles requests and calls handlers you write, such as Razor Pages or Web API controllers. Those handlers call application business logic, which typically does not depend directly on ASP.NET Core. The business logic can also interact with databases or remote APIs. section 1.1
Figure 1.1 A typical ASP.NET Core application consists of several layers. The ASP.NET Core framework code handles requests from a client, dealing with the complex networking code. Then the framework calls in to handlers (Razor Pages and Web API controllers, for example) that you write using primitives provided by the framework. Finally, these handlers call in to your application’s domain logic—typically, C# classes and objects without any dependencies that are specific to ASP.NET Core.
See how request handling, application handlers, and business logic fit together. section 1.1
Choose an application style based on what your users and other systems need:
- Use minimal APIs for simple HTTP APIs, or Web APIs when you want more structure and features. section 1.2
- Use Razor Pages for page-based server-rendered applications, or MVC controllers for server-rendered applications without the page-based model. section 1.2
- Use gRPC for binary server-to-server APIs. Blazor WebAssembly runs a single-page application in the browser; Blazor Server sends UI events and updates over WebSockets. section 1.2
These styles share building blocks such as configuration and logging, and you can combine them in one application. Consider API requirements, existing systems, users’ environments, scalability, and uptime when choosing. section 1.2
A request normally reaches the application’s web server, Kestrel by default. The server turns the incoming request into an HttpContext, which holds information for that request and its response. The middleware pipeline processes the request; an endpoint can generate a response, which passes back through the pipeline and server to the client. A reverse proxy may sit in front of the application. section 1.4.2 section 3.1
Figure 3.1 An overview of an ASP.NET Core application. The ASP.NET Core application receives an incoming HTTP request from the browser. Every request passes to the middleware pipeline, which potentially modifies it and then passes it to the endpoint middleware at the end of the pipeline to generate a response. The response passes back through the middleware to the server and finally out to the browser.
Follow a request through the server and middleware pipeline and back to the browser. section 3.1
A first minimal API
Start with an application template that returns “Hello World!” from an HTTP API. The local workflow is to generate the project, restore its NuGet dependencies, build it, and run it. With the .NET CLI, the corresponding commands are dotnet new, dotnet restore, dotnet build, and dotnet run. Visual Studio templates offer another way to start. section 3.2 section 27.1.1
A successful build produces application artifacts, but deployment requires publishing the app to include additional files. Cross-platform development also has a practical caveat: Windows-specific APIs remain available only on Windows, even when enabled through the Windows Compatibility Pack. section 27.1.1 section 2.4.2


