Released · improving
Framework · Since 2016
ASP.NET Core is Microsoft's open-source, cross-platform web framework for building fast web APIs, web apps and real-time services in C#.
ASP.NET Core is an open-source web framework that runs on .NET. Released in 2016 as a ground-up redesign of the original ASP.NET, it can be developed and run on Windows, macOS and Linux. The Kestrel web server, dependency injection, a middleware pipeline, configuration and logging are built in, so a server application works without assembling the basics yourself.
ASP.NET Core is widely used where performance and maintainability both matter: REST APIs, enterprise line-of-business systems and microservices. On one foundation you can choose concise minimal APIs, MVC controllers, Razor Pages or Blazor, work with databases through Entity Framework Core and add real-time features with SignalR. The SDK also supports building container images and deploying to the cloud.
To get started, install the .NET SDK, create an empty project with dotnet new web, and follow the official Microsoft Learn tutorial to build a minimal API. Knowing basic C# makes everything easier. From there, move on to dependency injection, middleware, configuration and EF Core to cover what real projects need.
The lightweight built-in Kestrel server and an asynchronous programming model let apps handle many requests with modest resources.
Service registration, the request pipeline, configuration and logging are part of the framework, giving every app a consistent structure.
Minimal APIs, MVC controllers, Razor Pages and Blazor share the same routing and middleware, so you can pick and mix them as needed.
Apps run on Windows, macOS and Linux, with per-environment configuration, health checks and container image builds for operations.
Download and install the .NET SDK for your operating system from dotnet.microsoft.com. ASP.NET Core is included; afterwards, check that the SDK is listed.
dotnet --list-sdksCreate an empty ASP.NET Core project from the web template. If you are building an API from the start, the webapi template is another good choice.
dotnet new web -o HelloWebMove into the project folder and start the app with dotnet watch. Edits are applied with Hot Reload; open the address printed in the console.
cd HelloWeb && dotnet watchThis is the Program.cs created by dotnet new web. WebApplication.CreateBuilder sets up configuration, logging, dependency injection and the Kestrel server, and MapGet registers an endpoint that returns a string for GET requests to /. app.Run() starts the server: run dotnet run and open the address shown in the console to see Hello World!.
Program.cs
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.Run();
dotnet new web -o HelloWeb && cd HelloWeb && dotnet runSix chapters that take you from installation to the core ideas of ASP.NET Core.
Ask questions, share experience and trade opinions about ASP.NET Core.
No discussions yet. Start the first one.
0 comments
Sign in · Sign in to leave a comment.
Be the first to comment.