ASP.NET
Before talking about ASP.NET Core, we should know what ASP.NET is. ASP.NET is a web application framework developed by Microsoft to build web applications and services. It extends the .NET platform with tools and libraries specifically for building web apps.
These are some things that ASP.NET adds to the .NET platform:
- Base framework for processing web requests
- Web-page templating syntax, known as Razor, for building dynamic web pages using C#
- Libraries for common web patterns, such as Model View Controller (MVC)
- Authentication system that includes libraries, a database, and template pages for handling logins, including multi-factor authentication and external authentication with Google, Twitter, and more.
- Editor extensions to provide syntax highlighting, code completion, and other functionality specifically for developing web pages
ASP.NET supports a number of programming models for building web applications and services:
- ASP.NET Web Forms – An event-driven application model for building modular pages out of components, with UI events being processed server-side.
- ASP.NET MVC – A MVC application model for building web pages using the model–view–controller design pattern.
- ASP.NET Web Pages – A SPA (Single Page Application) application model for adding dynamic code and data access directly inside HTML markup.
- ASP.NET Web API – An API application model for building Web APIs on top of the .NET Framework.
- SignalR – A real-time communications framework for bi-directional communication between client and server.
ASP.NET Core
ASP.NET Core is the open-source version of ASP.NET, it is a cross-platform framework for building web applications and web APIs that runs on macOS, Linux, and Windows. ASP.NET Core was first released in 2016 and is a redesign of earlier Windows-only versions of ASP.NET 4.x, with architectural changes that result in a leaner, more modular framework. With ASP.NET Core, you can:
- Build web apps and services, IoT apps, and mobile backends.
- Use your favorite development tools on Windows, macOS, and Linux.
- Deploy to the cloud or on-premises.
- Run on .NET Core or .NET Framework.
The following diagram shows the relationship between ASP.NET Core, ASP.NET, .NET Core, and .NET Framework. ASP.NET Core runs on both .NET Framework and .NET Core, so it can run cross-platform. Conversely, ASP.NET runs on .NET Framework only, so is tied to the Windows OS.
ASP.NET Core provides the following benefits:
- A unified story for building web UI and web APIs.
- Architected for testability.
- Razor Pages makes coding page-focused scenarios easier and more productive.
- Blazor lets you use C# in the browser alongside JavaScript. Share server-side and client-side app logic all written with .NET.
- Ability to develop and run on Windows, macOS, and Linux.
- Open-source and community-focused.
- Integration of modern, client-side frameworks and development workflows.
- Support for hosting Remote Procedure Call (RPC) services using gRPC.
- A cloud-ready, environment-based configuration system.
- Built-in dependency injection.
- A lightweight, high-performance, and modular HTTP request pipeline.
- Ability to host on the following:
- Kestrel
- IIS
- HTTP.sys
- Nginx
- Apache
- Docker
- Side-by-side versioning.
- Tooling that simplifies modern web development.
ASP.NET Core provides the following components:
- Entity Framework (EF) Core
- Identity Core
- MVC Core
- Razor Core
- SignalR
- Blazor