ASP.NET Core: Introduction

Build modern, cross-platform, cloud-ready web applications and services.

What is ASP.NET Core?

ASP.NET Core is a free, open-source, cross-platform framework for building modern, cloud-based, Internet-connected applications. It is a rewrite of the ASP.NET platform, designed for performance, modularity, and extensibility.

Unlike previous versions of ASP.NET, ASP.NET Core can:

  • Be hosted on Windows, macOS, and Linux.
  • Be deployed as a self-contained application or using IIS, Nginx, Apache, Docker, or Azure App Service.
  • Be developed using C#, F#, or Visual Basic.
  • Support multiple development workflows, including the use of Integrated Development Environments (IDEs) like Visual Studio, Visual Studio Code, and JetBrains Rider.

Key Features

  • Cross-Platform: Develop and deploy on Windows, macOS, and Linux.
  • High Performance: Built from the ground up for speed and efficiency.
  • Modular Design: Lightweight, with only the components you need.
  • Unified MVC and Web API: A single programming model for building web UIs and APIs.
  • Dependency Injection: Built-in support for dependency injection.
  • Blazor: Build interactive web UIs using C# instead of JavaScript.
  • Tag Helpers: Server-side HTML generation for cleaner Razor markup.
  • Configuration: Flexible configuration system from various sources.
  • Logging: A flexible logging framework.

Architecture

ASP.NET Core applications are built around middleware pipelines. A request flows through a series of components, each performing a specific task like routing, authentication, or response generation. This modular approach makes it easy to customize and extend the framework.

Core components include:

  • Kestrel: The default, cross-platform web server for ASP.NET Core.
  • Middleware: Components that process HTTP requests and responses.
  • Hosting: The mechanism by which your application is hosted and managed.
  • Dependency Injection: The built-in system for managing dependencies.

Getting Started

To start building with ASP.NET Core, you'll need:

  1. .NET SDK: Download and install the latest .NET SDK from the official .NET website.
  2. IDE: Visual Studio, Visual Studio Code with the C# extension, or JetBrains Rider.

Creating your first project

Using the .NET CLI:

dotnet new webapp -o MyWebApp
cd MyWebApp
dotnet run

This command creates a new web application project named MyWebApp and then runs it.

Important Note

ASP.NET Core is a major evolution from ASP.NET. While many concepts are similar, they are not directly compatible. Migration from ASP.NET to ASP.NET Core requires significant code changes.

Explore the following sections to dive deeper into specific ASP.NET Core features: