The first preview release of ASP.NET came out almost 15 years ago as part of the .NET Framework. Since then millions of software developers have used it to build and run all types of great web applications. Over the years Microsoft has added and evolved many of its features until coming up with a complete redesign of the ASP.NET Framework called ASP.NET Core in June 2016. After ASP.NET Core 1.0 and 1.1, version 2.0 is the third and latest installment of ASP.NET Core. Let's see what it offers and when it makes sense to use it in your projects.
ASP.NET Core 2.0 is a new open-source and cross-platform framework for building modern cloud-based applications, such as web applications, Internet of Things (IoT) applications and even mobile backend.
ASP.NET Core 2.0 applications run on the .NET Core Framework as well as on the full .NET Framework. The ASP.NET Core Framework was architected to provide an optimized development framework for applications, which have to be deployed either within the cloud or on-premises. It consists of modular components with minimal overhead, so you retain a high degree of flexibility when conceiving and implementing your software solutions. You can develop and run your ASP.NET Core 2.0 applications on Windows, Linux, and macOS.
In the following diagram you can see how the different .NET Framework versions and components work together:
ASP.NET Core 2.0 includes several architectural changes that result in a much leaner and more modular framework when compared to the framework that came before it. It is no longer based on System.Web.dll, instead, it uses a set of granular and well factored NuGet packages. This allows optimizing of applications to include just the NuGet packages that are really needed.
The benefits of a smaller application surface area include:
- Better security
- Reduced dependencies between components
- Improved performance
- Decreased optimized financial costs in a pay-for-what-you-use cloud consumer world
As a developer, when building applications based on the classic .NET Framework, you must choose between six application models (WPF, Windows Forms, Web Forms, Web MVC, Web API, and Xamarin), which can be confusing and not very productive.
With the release of the ASP.NET Core 1.0 and 1.1, this was optimized and reduced to three different application models, with the drawback that you cannot share code between them.
With ASP.NET Core 2.0, the number of application models was further reduced to two and code is now sharable, meaning that you can now reuse more than 90% of your code. For you as a developer, this makes you more productive and allows for switching between application models quickly and easily.
In this chapter, we will cover the following topics:
- ASP.NET 2.0 features
- Cross-platform support
- Microservice architecture
- Working with Docker and containers
- Performance and scalability
- Side-by-side deployments
- Technology restrictions
- When to choose ASP.NET Core 2.0