Back to: ASP.NET Core Tutorials For Beginners and Professionals
Introduction to ASP.NET Core Framework
In this article, I am going to give you a brief introduction to ASP.NET Core Framework. Nowadays, when it comes to software development, everyone is talking about Free, Open-Source, and Cross-Platform Development. As we all know, Microsoft is well known for its Windows-based products. Now, we are in the new age of software development. For this, a new revolutionary product came into the market by Microsoft, and it is ASP.NET Core. As part of this article, we are going to discuss the following pointers in detail.
- History of ASP.NET
- What is ASP.NET Core
- Why ASP.NET Core?
- Where can we Develop Applications using .NET Core?
- What the ASP.NET Core doesn’t have?
- .NET Core vs. ASP.NET Core
- Language Support
History of ASP.NET
As we know, ASP.NET is the framework that has been used to develop Data-Driven Web Applications for many years. Since then, the ASP.NET Framework has gone through a steady evolutionary change, and finally, the most decent evolution is ASP.NET Core (you can also call it.NET).
- The ASP.NET Core (.NET) is not a continuous part of the ASP.NET 4.x Framework. Instead, it is a completely new framework.
- This Framework is an actual rewrite of the current ASP.NET 4.x Framework but with a much smaller and a lot more modular.
- Some people think that many things remain the same, but that is not completely true. The ASP.NET Core is actually a big fundamental change to the ASP.NET Framework.
What is ASP.NET Core?
According to Microsoft, ASP.NET Core is the open-source version of ASP.NET that runs on Windows, Linux, macOS, and Docker.
ASP.NET Core is the new version of the ASP.NET Web Framework mainly targeted to run on the .NET Core Platform. ASP.NET Core is a FREE, OPEN-SOURCE, HIGH-PERFORMANCE, LIGHTWEIGHT, AND CROSS-PLATFORM Framework for building Web Applications on the .NET (.NET Core) Platform. It is designed to run on the cloud as well as on-premises.
Performance is a key focus of ASP.NET Core. It’s faster than other popular web frameworks. ASP.NET Core was architected modular with minimum overhead, and then other more advanced features can be added as NuGet Packages as per application requirements. This results in high performance, requires less memory and deployment size and is easy to maintain.
.NET (.NET Core) is open source and cross-platform and is maintained by Microsoft and the .NET community on GitHub. All aspects of .NET are open source, including class libraries, runtime, compilers, languages, ASP.NET Core web framework, Windows desktop frameworks, Entity Framework Core data access library, and more.
.NET is open source on GitHub and has over 100,000 contributions, and 3,700 companies have already contributed. You can also contribute or download the source code from the ASP.NET Core Repository on GitHub
https://github.com/dotnet/aspnetcore
ASP.NET Core 3.x and later version applications can be targeted to develop and run on top of the .NET Core (Cross-platform) only, whereas ASP.NET Core 1.x and 2.x applications can be targeted to develop and run on top of the .NET Core (Cross-platform) as well as .NET Framework (Windows only).
The latest version of .NET Core is .NET 7, released in November 2022. Beginning with .NET 5.0, Microsoft .NET core has been re-branded as .NET. So from now on, the word “Core” will not be used, and they will be called .NET 6, .NET 7, etc.
A new major release of .NET Core is published every year in November. Even numbered releases are LTS releases that get free support and patches for three years. Odd-numbered releases are STS releases that get free support and patches for 18 months.
Starting with the .NET core, Microsoft will release a .NET framework once every two years with Long-Term Support (LTS) of 3 years. Between those two years, Microsoft will release a framework with Short-Term Support (STS), which is 18 months. For a better understanding of the .NET and .NET Core release lifecycle, please look at the image below.
Please check the below URL for more detailed information:
https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core
Note: ASP.NET Core was initially launched as ASP.NET 5, but later, it was renamed to ASP.NET Core, and now it is called .NET.
Why ASP.NET Core?
Nowadays, the ASP.NET Core framework is becoming more and more popular among developers. There are a number of reasons why modern developers are using it, and some of them are listed below:
Open Source:
The ASP.NET Core framework is Open Source, which is the main reason behind its popularity. The Entire Source Code of this .NET Core Framework is available at https://github.com/aspnet, and you are free to download the source code. Even if you want, you can also modify and compile your own version.
.NET Core team is always there to support your effort in the seamless development of the application. It receives bug fixing and improvement updates on a regular basis, usually within a short time period. You don’t have to wait longer for updates. The flexibility in framework code keeps it at the top of the developer’s choice. Depending upon the project’s requirements, libraries and framework components can be added later.
Cross-Platform:
The ASP.NET Core Framework is designed from scratch to keep in mind to be Cross-Platform for both development and deployment. So, we don’t need to build different applications for different platforms using different frameworks. Let us discuss what Cross-Platform is from the ASP.NET Core point of view by comparing it with the earlier versions of the ASP.NET Framework.
The earlier versions of ASP.NET Framework applications can only run on Windows platforms. In contrast, the ASP.NET Core applications can be developed and run on different platforms such as Windows, Mac, or Linux operating systems. We can host the earlier ASP.NET Framework 4.x applications only on IIS, whereas we can host the ASP.NET Core applications on IIS, Nginx, Docker, Apache, or even self-host deployment.
To develop ASP.NET Core applications, you have multiple options; you can use either Visual Studio or Visual Studio Code. If you want, then you can also use any third-party editors of your choice, such as ATOM, Sublime, etc.
CLI Support: Using CLI (Command Line Interface) commands, you can develop and run .NET applications and publish the application using the CLI command. Our upcoming articles will discuss developing, building, and running .NET Core Applications using CLI.
Fast: ASP.NET Core no longer depends on System.Web.dll for browser-server communication. ASP.NET Core allows us to include packages that we need for the application. This reduces the request pipeline and improves performance and scalability.
IoC Container: One of the most important used design patterns in the real-time application is the Dependency Injection Design Pattern. It includes the built-in IoC (Inversion of Control) container for automatic dependency injection, making it maintainable and testable.
Unified MVC and Web API Framework:
The ASP.NET Core provides a unified programming model for developing both Web Apps and Web APIs. That means a single controller class can be used to handle both. The Controller we create in ASP.NET Core (either Web APPs or Web APIs) application is going to inherit from the Controller base class and returns the IActionResult interface. The IActionResult interface provides several implementations. The built-in results types, such as the JsonResult and the ViewResult (like this, there are so many result types available that we will discuss later), implement the IActionResult interface.
In the ASP.NET Core Web API application, the controller action method is going to return JsonResult. At the same time, if it is an ASP.NET Core Web application, then the controller action method is return type will be ViewResult.
Testing and Maintainability:
You can easily test and maintain the applications developed using the ASP.NET Core MVC framework. This is possible because it allows you to separate different parts of your application into independent pieces, and it also allows you to test them independently. The Testing frameworks such as MSTtest, xUnit, and MOQ can be easily integrated into ASP.NET Core MVC applications for simulating any scenario.
Integration with Modern UI Framework: It allows you to use and manage modern UI frameworks such as AngularJS/Angular, React JS, Bootstrap, etc…
Handling Request and Response Pipeline:
We can handle the request and response in the ASP.NET Core application by using the new Middleware Components. In earlier ASP.NET 4.x, we generally use Handlers and Modules to handle the Request and Response pipeline. The ASP.NET Core Framework provides a lot of built-in Middleware Components, and we can use those Middleware Components to handle the request and response pipeline. If you want, then you can also create your own middleware components and use them in the request-response pipeline. In a later article, we will discuss the Middleware Components in detail. We will also discuss how to create custom Middleware Components and how to use them in ASP.NET Core applications.
Hosting:
ASP.NET Core web application can be hosted on multiple platforms with any web server such as IIS, Apache, etc… It is not dependent only on IIS as a standard .NET Framework.
Code Sharing: It allows you to build a class library that can be used with .NET Frameworks such as .NET Framework 4.x or Mono. Thus, a single code base can be shared across frameworks.
Side-by-Side App Versioning: ASP.NET Core runs in .NET Core, which supports the simultaneous running of multiple versions of applications.
Extensible Framework:
The ASP.NET Core MVC Framework is designed to be highly extensible. That means you can create an application today that can be extended to any level in the future. Some of the key features provided by this framework that give it extensible power are as follows.
- View Components
- Tag Helpers
- Routing
In our upcoming articles, we will discuss each of these features in detail.
Smaller Deployment Footprint:
ASP.NET Core application runs on .NET Core, which is smaller than the full .NET Framework. So, the application that uses only a part of .NET CoreFX will have a smaller deployment size. This reduces the deployment footprint.
Excellent developer tools:
ASP.NET Core comes with a lot of preloaded tools. Anybody would love to work with these tools due to their simplicity and ease. Using Libmam (Libmam allows the installation of Bootstrap and JQuery easily), ReSharper (ReSharper provides on-the-fly code analysis and eliminates errors in C#, VB.NET, XAML, ASP.NET, and XML), and other tools, it is very easy to build tests and other extraordinary applications.
Versatility: Apart from modern data-driven Aeb Applications, users can also develop mobile and desktop applications. They can switch whenever they want.
What the ASP.NET Core Doesn’t Have?
If you are coming from ASP.NET 4.x, then you will not find the following things in ASP.NET Core.
- The Global.asax file
- Web.Config file
- HTTP Handlers and HTTP Modules
- ASP.NET Page Life-Cycle model
Difference Between ASP.NET MVC and Web Forms
ASP.NET MVC
- ASP.NET MVC is best for developing an interactive web application with the latest web standards
- ASP.NET MVC is based on an architectural design pattern that separates the application into three components. Model (data and business logic), View (UI representation), Controller (handles user input and orchestrates between model and view)
- ASP.NET MVC enforces a clear separation of concerns by dividing the application into three components. The model, view, and controller are separate entities with distinct responsibilities that provide better code organization, maintainability, and testability
- ASP.NET MVC has a flexible and configurable routing system that allows customers to define custom routes that map URLs to specific controller actions
- ASP.NET MVC promotes testability by separating concerns and makes it easier to write unit tests
ASP.NET Web Forms
- ASP.NET Web Forms is best for rapid development with powerful data access
- ASP.NET Web Forms follows a traditional event-driven programming model. The application is built around server controls
- ASP.NET Web Forms often mixes presentation and the business logic in the same code behind the file, making it harder to separate concerns and maintain clean code
- ASP.NET Web Forms has a file-based routing mechanism where URLs correspond to physical files on the server
- It can be challenging to write unit tests for ASP.NET Web Forms due to the tight coupling between UI and server-side logic
Differences Between .NET Framework and .NET Core
.NET Framework
- .NET framework is compatible only with the Windows Operating system. It relies on Windows-only components and APIs and is tightly integrated with the Windows ecosystem.
- .NET Framework is proprietary software developed and maintained by Microsoft
- .NET Framework is suitable for a wide range of application types, including desktop applications (Windows Forms, WPF), web applications (ASP.NET Web Forms, MVC), and services (Windows Services, WCF).
.NET Core
- .NET Core is designed to be platform-independent or cross-platform and run on multiple operating systems. This cross-platform capability makes it suitable for building applications that can be deployed on Windows, macOS, and Linux environments.
- .NET Core is open source on GitHub and has over 100,000 contributions, and 3,700 companies have already contributed.
- .NET Core is primarily focused on modern application development, such as Web Applications (ASP.NET Core), Microservices, and Cloud-Native Applications.
.NET Core (.NET) vs ASP.NET Core:
Many people are confused between ASP.NET Core and .NET Core. Please note that ASP.NET Core and .NET Core are not the same. They are different, just like ASP.NET and .NET Framework are different. ASP.NET Core is a fast, lightweight, modular, and open-source framework for creating Web Applications, Mobile Applications, and Web Services that run on Windows, Linux, and macOS. .NET Core is a software platform or you can say Runtime Environment on which ASP.NET Core applications run.
.NET Core (.NET):
- .NET Core (.NET) is an open-source and cross-platform. It basically provides the runtime environment where the ASP.NET Core Web Applications are going to be run.
- .NET Core is a runtime to execute applications that are built on it.
- Install .NET Core Runtime to run applications and install .NET Core SDK to build applications.
- .NET 7 is the latest stable version. .NET 8 is in Preview.
ASP.NET Core:
- ASP.NET Core is an Open Source and Cross Platform Framework using which we can develop different types of Web Applications such as MVC, Web API, Razor Pages, etc.
- ASP.NET Core is a Web Application Development Framework to build Web Applications, IoT Applications, and Mobile Applications, which is going to be run on the top of the .NET Core Platform. If you are developing an application using ASP.NET Core 1.x or 2.z, then you can run the ASP.NET Core Application using both .NET Framework and .NET Core Platform.
- If you want to develop and run .NET Core Applications, you need to install .NET SDK, including the .NET Runtime. If you only want to run .NET Core Applications, then you only need to install .NET Core Runtime.
- ASP.NET Core 7 is the latest stable version, and ASP.NET Core 8 is in Preview.
Note: There is no separate versioning for ASP.NET Core. It is the same as the .NET Core versions.
Language Support:
Dot Net Core Framework supports the following language, i.e., using the following languages, you can develop .NET Core applications. We are going to use C# as the programming language in this course.
- C#
- F#
- Visual Basic (VB)
.NET Core GitHub Repository:
.NET Core Runtime: https://github.com/dotnet/runtime
.NET Core SDK: https://github.com/dotnet/sdk
ASP.NET Core GitHub Repository: https://github.com/dotnet/aspnetcore
The Latest version of .NET Core is 7.
The latest version of ASP.NET Core also is 7.
There is no separate versioning of ASP.NET Core. It is the same as the .NET Core Versions.
.NET Core is named “Core” because it includes core features of .NET Framework. The main objective of .NET Core is to make .NET Framework open-source and cross-platform compatible so that it can be used in resource-constrained environments. It includes minimum features that are required to run a basic .NET Core application and other advanced features that can be as a package from NuGet.
Summary:
With ASP.NET Core, you can:
- Build web apps and services, Internet of Things (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.
In the next article, I am going to discuss the ASP.NET Core Environment Setup Required for Developing ASP.NET Core Web Applications using Visual Studio. Here, in this article, I try to give a brief introduction to ASP.NET Core Framework. I hope this Introduction to ASP.NET Core Framework article will help you with your needs.
About the Author: Pranaya Rout
Pranaya Rout has published more than 3,000 articles in his 11-year career. Pranaya Rout has very good experience with Microsoft Technologies, Including C#, VB, ASP.NET MVC, ASP.NET Web API, EF, EF Core, ADO.NET, LINQ, SQL Server, MYSQL, Oracle, ASP.NET Core, Cloud Computing, Microservices, Design Patterns and still learning new technologies.
Thanks to the author of this article. It was awesome
Thanks for this tutorial. Very well explained
i am beginner and now these days i enjoy these tutorials
Thanks, this tutorials help me a lotm very nice article!
Thanks, this tutorials help me a lot very nice article!
very nice article among the top most sites
Thanks
I am beginner and this tutorial very helpful for me . Thanks a lot dotnettutorials.
This tutorial are really amazing.Grateful to the author.
very informative and realistic article
Nice article. I am very happy to read this
Please update to .NET 5
Very soon we are going to update the tutorials using the latest DOT NET Core as well as we are going to finish the course.
This tutorials really help me, very informative and nice article
Thanks you
Great tutorial
Love these tutorials!
EXCELLENT
Great explanation. Thanks
Sometimes you say, ASP.NET is .NET, and other times you say its a framework on top of .NET. Very confusing.
EXAMPLE:
Note: ASP.NET Core was initially launched as ASP.NET 5, but later, it was renamed to ASP.NET Core, and now it is called .NET.
ANOTHER EXAMPLE:
ASP.NET Core:
1. ASP.NET Core is Open Source and Cross Platform Framework.
2. ASP.NET Core is a Web Application Development Framework to build Web Applications, IoT Applications, and Mobile Applications, which is going to be run on the top of the .NET Core Platform. If you are developing an application using ASP.NET Core 1.x or 2.z, then you can run the ASP.NET Core Application using both .NET Framework and .NET Core Platform.
#2 above says ‘ASP.NET Core is a web application development framework……. which is going to be run on the top of the .NET core platform’.
A simple one liner explanation would be great.
.NET Core (.NET) and ASP.NET Core are two different things. .NET Core (.NET) provides the runtime environment where the ASP.NET Core Web Applications are going to be run. ASP.NET Core is the Web Application Development Framework using which you can develop different kinds of Web Applications.
Both .NET Core (.NET) and ASP.NET Core are cross-platform and Open Source.