Introduction

ASP.NET Core is Microsoft's framework for building web apps and APIs in C# — cross-platform, open source, and the direct successor to the older, Windows-only ASP.NET. This lesson assumes you already know C#; if you don't, the site's C# course covers it first.

Creating a new project

The dotnet CLI scaffolds a new project from a template. web gives you a minimal, empty ASP.NET Core project — no MVC folders, no extra files:

Terminal
dotnet new web -o HelloApi
cd HelloApi
dotnet run
Output
Building...
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5225
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development

The project is now a real, running web server. Visiting http://localhost:5225 in a browser hits whatever code you've mapped to that URL.

The minimal Program.cs

Modern ASP.NET Core apps start from a single, short Program.cs — no separate Startup class required for a small project:

C# Program.cs
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

app.MapGet("/", () => "Hello, ASP.NET Core!");

app.Run();
Response body at GET /
Hello, ASP.NET Core!

WebApplication.CreateBuilder(args) sets up configuration, logging, and dependency injection with sensible defaults. app.MapGet(...) maps a URL pattern and HTTP method to a handler — you'll see much more of this in the next lesson. app.Run() starts the server and blocks until it's shut down.

Note: this "minimal API" style (introduced in .NET 6) is what this course uses for routing basics, but ASP.NET also supports the older, more structured MVC controller style — covered starting in lesson 3 — which scales better once a project has dozens of endpoints.