Getting Started with ASP.NET Core

This section documents ASP.NET Core on .NET 10 (LTS), the current release — the minimal hosting model, the middleware pipeline, dependency injection, Minimal APIs, MVC & Razor Pages, Blazor with the current render modes, SignalR and gRPC, EF Core, ASP.NET Core Identity and policy-based authorization, output caching, rate limiting, and Native-AOT-aware building — as described by the official documentation at Microsoft Learn, which is the reference these pages are written and verified against.

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. .NET ships a major release every November and its APIs continue to evolve: the examples here target .NET 10 / C# 14.

This section’s bibliography lists the reference material consulted while preparing these pages.

ASP.NET Core is a cross-platform, open-source framework for building web apps, HTTP APIs, and real-time services on .NET. This page gets you from an installed SDK to a running app and explains how the pieces fit together.

What ASP.NET Core is

ASP.NET Core runs on Windows, Linux, and macOS, is developed in the open, and unifies MVC, Web API, Razor Pages, Blazor, SignalR, and gRPC on one HTTP server and one dependency-injection container. It is a complete rewrite of the older .NET Framework "ASP.NET" and shares almost no API with it.

  • .NET 10 is a Long-Term Support (LTS) release — C# 14, released November 2025, supported for three years. .NET ships a major version every November: even-numbered releases (8, 10, 12) are LTS (3 years), odd-numbered (9, 11) are Standard-Term Support (18 months).

  • Every example in this section targets .NET 10 / C# 14 and the minimal hosting model.

The SDK and the dotnet CLI

Install the .NET 10 SDK, then everything else is the dotnet command:

dotnet --info                       # installed SDKs and runtimes
dotnet new list                     # available templates
dotnet new web      -o Api          # empty minimal app
dotnet new webapi   -o Api          # HTTP API (Minimal API by default; --use-controllers for MVC)
dotnet new webapp   -o Site         # Razor Pages
dotnet new mvc      -o Site         # MVC
dotnet new blazor   -o App          # Blazor Web App

dotnet run                          # build + run
dotnet watch                        # run with hot reload
dotnet build -c Release             # compile
dotnet publish -c Release           # produce a deployable folder
dotnet test                         # run the test project
dotnet add package Serilog.AspNetCore

Project layout

A new web project is small:

<!-- Api.csproj -->
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>
</Project>
  • Program.cs — the entry point and app configuration (see below).

  • appsettings.json + appsettings.{Environment}.json — configuration, layered by environment.

  • Properties/launchSettings.json — local run profiles (URLs, environment variables); not deployed.

  • wwwroot/ — static files served at the site root.

// appsettings.json
{
  "Logging": { "LogLevel": { "Default": "Information" } },
  "AllowedHosts": "*"
}

The minimal hosting model

Modern ASP.NET Core apps have no Startup class. Program.cs uses top-level statements: build a WebApplication, register services, add middleware, run.

var builder = WebApplication.CreateBuilder(args);

// 1. Register services in the DI container.
builder.Services.AddOpenApi();
builder.Services.AddSingleton<IGreeter, Greeter>();

var app = builder.Build();

// 2. Configure the middleware pipeline (order matters).
if (app.Environment.IsDevelopment())
{
    app.MapOpenApi();
}
app.UseHttpsRedirection();

// 3. Map endpoints.
app.MapGet("/hello/{name}", (string name, IGreeter g) => g.Greet(name));

app.Run();

public interface IGreeter { string Greet(string name); }
public sealed class Greeter : IGreeter
{
    public string Greet(string name) => $"Hello, {name}!";
}

WebApplication.CreateBuilder wires up configuration, logging, DI, and Kestrel with sensible defaults. See Minimal APIs overview and Request pipeline and middleware.

Choosing an app model

Model Use it for

Minimal APIs

New JSON/HTTP APIs; the least ceremony. Details.

Controller-based Web API

Larger APIs wanting conventions, filters, and ApiController behavior. Details.

Razor Pages

Page-focused server-rendered sites (forms, CRUD screens). Details.

MVC

Server-rendered sites that benefit from separate controllers, views, and shared layouts. Details.

Blazor

Interactive C# UI in the browser (SPA-like). Details.

SignalR

Server-to-client push (chat, dashboards, notifications). Details.

gRPC

High-performance service-to-service RPC with a .proto contract. Details.

Tooling and dev setup

  • IDE: Visual Studio, VS Code with the C# Dev Kit, or JetBrains Rider.

  • HTTPS: trust the local development certificate once:

    dotnet dev-certs https --trust
  • .NET 10 Kestrel resolves any *.localhost host name to the loopback address, so per-app host names such as https://api.localhost:7010 work with no hosts-file edits.

For client-side integration, ASP.NET Core hosts SPA front-ends (React, Angular, Vue) via the SPA proxy templates, ships LibMan for pulling client libraries into wwwroot, and works with any bundler. See the React Reference and the Angular Reference for those frameworks, and the SPA integration guide.