Introduction to ASP.NET Core
ASP.NET core is the brand new open-source , cross-platform framework to build web applications using Microsoft .NET. The .NET core is a completely new concept and .NET core has a very new CoreCLR , CLI (Command Line Interface) , request handling pipeline and more. That is the reason Microsoft re-branded the ASP.NET 5 to ASP.NET Core 1.0 . However , ASP.NET core is also a pure MVC and we have models, controls , views , razors etc like the previous versions of ASP.NET.
Why we need a new framework ?
- Open-Source – Its open-source and source code is available on github.
- Cross-Platform – It can be built , run on Windows, Mac and Linux.
- Cloud Ready – Completely new optimized features , configuration for Azure.
- Completely Modular – Everything is Nuget packages . Just plug and play.
- Wide Verity of tools and editors – We have command line tools , Visual Studio , Visual Studio Code.
- Super Fast – Its faster compare to previous versions of ASP.NET and even Node.js.
See the recent benchmark 1.15 MILLION requests per second from community. 2300% More Requests Served Per Second.
Image source: web.ageofascent.com
ASP.NET core MVC no longer relies System.Web assembly . That means there we can do self hosting and the request cycle will be faster .
The Modern Rules Of Asp.net Core MVC
Middleware are components that are assembled into an application pipeline to handle requests and responses. Each component can choose whether to pass the request on to the next component in the pipeline, and can perform certain actions before and after the next component in the pipeline. Middleware component in the ASP.NET core is asynchronous and light weight . We have a built-in middleware component for Authentication , CORS , Diagnostics , Routing , Session and Static Files. We can even create a custom middleware. In the project we have startup.cs class to define the middleware components.
Dependency Injection is built-in in ASP.NET core. If you do not want to use the built-in IOC container, then you can easily replace with your favorite IOC containment like Ninject.
We do not have Web.config file here. Instead of this we have new light weight configuration system in ASP.NET core. ASP.NET core supports a variety of different configuration options. Application configuration data can come from files using built-in support for JSON, XML, and INI formats, as well as from environment variables.
In previous version of ASP.NET we were creating an own logging framework or using other third party components like loge4net. This logging component will be tightly coupled with the application. The ASP.NET core has nice brand new logging mechanism with dependency injection . The one of the coolest thing is that the logging functionality is enabled by default.
In the previous version of ASP.NET we have a separate framework for Web pages, MVC and Web API . But ASP.NET core is a unified web framework. Its wrap MVC, Web page and Web API into a single framework.
Web pages + MVC + Web API = ASP.NET Core MVC
ASP.NET 4.6 is the fully supported and stable version now. It includes MVC, Web API , SignalR , Web pages etc . But in ASP.NET core 1.0 release, we have only Web API and MVC and It doesn’t yet support VB or F#. ASP.NET team still working hard to add more feature on ASP.NET core.
Latest posts by Tom Mohan (see all)
- How to choose a WCF binding ? - January 29, 2017
- Get free Azure trial worth ₹50,000 and Azure webinar series . - September 3, 2016
- .NET core : Build and run in any platform. - August 7, 2016