ASP.NET Core is Microsoft's modern, cross-platform, high-performance framework for building web applications, APIs, and microservices using C# and .NET. It runs on Windows, macOS, and Linux, offering a modular, lightweight architecture with built-in dependency injection, middleware pipelines, and support for MVC controllers, Minimal APIs, Razor Pages, and the unified Blazor Web App model for interactive UIs. Understanding the separation of concerns through middleware (request pipeline), filters (MVC-specific logic), and services (DI-injected components) is key to building scalable systems. .NET 10 (LTS, supported through November 2028) is the current recommended runtime, bringing built-in OpenAPI 3.1 generation, native Minimal API validation, and EF Core 10 features including vector search and named query filters.
What This Cheat Sheet Covers
This topic spans 24 focused tables and 249 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Application Types and Hosting
| Type | Example | Description |
|---|---|---|
builder.Services.AddControllersWithViews();app.MapControllerRoute(...) | • Full Model-View-Controller pattern with server-side rendering via Razor views • ideal for traditional web apps with HTML generation. | |
builder.Services.AddControllers();app.MapControllers(); | • RESTful API using controllers returning JSON • often secured with JWT • returns data instead of views. | |
app.MapGet("/", () => "Hello");app.MapPost("/data", (Data d) => d); | • Lightweight endpoint routing without controllers • reduced boilerplate for microservices and simple APIs • supports DI via parameters. | |
builder.Services.AddRazorPages();app.MapRazorPages(); | • Page-centric model where each page combines handler methods with Razor markup • simpler than MVC for CRUD-heavy apps. | |
builder.Services.AddRazorComponents() .AddInteractiveServerComponents() .AddInteractiveWebAssemblyComponents(); | Unified Blazor model (.NET 8+) supporting per-component render modes (Static SSR, Interactive Server, Interactive WebAssembly, Auto) in one app. |