CodeDigest.Com Logo
Featured:

Start Learning Asp.Net Core - Part 1 - Introduction and Understanding the Basics & Fundamentals

Tagged as: Asp.Net Core .Net Core Posted By

Introduction

Asp.Net Core is Microsoft’s next big release of its Asp.Net framework. It is a complete re-write of existing Asp.Net framework and it has started a totally new way forward for developing web applications using Microsoft web stack. It works on both Full .NetFramework and a platform independent version of .Net framework called .Net Core, which is again a complete re-write of Microsoft .NetFramework for developing a new gen of applications. Asp.Net Core is initially named as Asp.Net vNext, then Asp.Net 5.0 and was later renamed to Asp.Net Core.

Before diving deep into Asp.Net Core and its specifics, let’s see the path of Asp.Net took all these years and major releases.

Evolution of Asp.Net to Asp.Net Core

The original Asp.Net framework with WebForms was designed to take the web development to next level by considering the frameworks and developer skills at that time. Prior to WebForms, web applications in Microsoft stack were built using ASP and the developers are more used to the event model of windows application (desktop applications). So, the WebForms development was a huge hit and it was dominating the web development in Microsoft stack for more than a decade. Slowly, Open Source web stack was taking the centre stage with release of many simple and light-weight framework which was very easy to develop and performed a way better than the Asp.Net Framework. The advantages of WebForms were fading away due to this, the things which are originally considered as advantage for choosing Asp.Net was actually becoming a disadvantage. For example, Asp.Net has heavily encapsulated HTTP, had bulk state management (Page ViewState) and the event-based model (both Request pipeline and Page lifecycle) has become over head when compared to the Open Source counter parts. Ruby on Rails (or Rails or ROR), the open source MVC framework has simplified the development of web application heavily and Java too had a similar framework called Spring MVC which are free from all the gutters of Asp.Net WebForms. This had led to the development of Asp.Net MVC, which is Microsoft’s answer to all the criticism over WebForms and to bring Microsoft web stack back on centre stage.

Asp.Net MVC, as the name suggests follow MVC pattern and had a very good separation of concerns between the layers which the WebForms lacked. Though the WebForms model had ASPX page and code behind model for separating view logic, it is almost impossible to have a clear separation of concerns between UI logic and Business logic. The MVC Controller and the View using Razor gave a greater flexibility to maintain separation of concerns. Asp.Net MVC followed Conventions over Configurations similar to Rails. For example, a view for a controller action will be automatically picked by the runtime if there is a view file that follows Views/[ControllerName]/[ActionName].cshtml construct under the project root. It was released as Open Source and developers had an opportunity to see the source code and customize it. Along with community participation, the MVC has become much more matured product than it would have been with only Microsoft’s effort. Asp.Net MVC together with Microsoft’s ORM Entity Framework has become a new default for developing web application on Microsoft stack. Microsoft also added WebAPI (REFTful) support for building API on similar lines of Asp.Net MVC framework.

The WebForms development were still in use and Microsoft has added more and more features though. Development team choosed between WebForms and MVC based on the team’s experience and their needs.

Though, Asp.Net MVC has brought many new changes but it was built on the existing Asp.Net framework and had many settings shared with WebForms framework. In other words, both Asp.Net MVC and WebForms are built on top of Asp.Net framework System.Web assembly. Due to this, Microsoft’s web stack was heavily dependent on IIS web server and its capabilities for providing many of its Infrastructure services. The Asp.Net runtime is built to satisfy all the web need and so it had many features of runtime plugged into every request pipeline regardless if its need in the application. The Asp.Net WebForms follows configuration based model and MVC follows Conventions over Configurations, due to this the resultant Asp.Net MVC project seemed messy since both model was built on top of System.Web. This had led to the development of OWIN, a specification for building webserver agnostic application in .Net. OWIN is community owned specification and it is not a framework by own. At this time, the Rails community had a support for webserver interoperability through a framework called Rack and OWIN specification was developed in that line. Listening to community, Microsoft developed Project Katana, an implementation of OWIN specification by Microsoft for building loosely coupled (with IIS) Asp.Net application. To understand more about OWIN and Project Katana, read the below articles.

What is OWIN? A Beginners Guide
Creating Our First OWIN Based Application
Understanding and Creating OWIN Middlewares - Part 1
Understanding and Creating OWIN Middlewares - Part 2

Asp.Net Core – the next big release

Microsoft released its next version of Asp.Net named as Asp.Net vNext with OWIN support. It is then renamed to Asp.Net 5.0 and it was finally re-branded as Asp.Net Core. It is a complete re-write of original Asp.Net framework with no dependency on System.Web. Asp.Net Core is a modular framework that gives developer an option to plugin only required components on the pipeline as opposed to System.Web pipeline. Asp.Net Core is released as fully open source, modular, OS independent framework that includes a new implementation of OWIN (Improved from all the feedbacks from Project Katana) and it runs on both .NetFramework and .Net Core framework for building Asp.Net cloud-optimized application.

Project Repository: https://github.com/aspnet/home

Asp.Net Core and its related components are delivered as Nuget packages. This modularity nature enabled the appllication to use only required features for request processing and thereby increased the overall performance.

.NetFramework (or Full .NetFramework) is the complete version of .Net runtime with Base Class Library that comes as part of Operating system or as separate installer packages. It is the version of .Net framework we used all these years, the latest version is 4.6.2. .Net Core is a new, complete re-write of existing .Net framework that is modular and OS independent. The current version as of this writing is 1.1(and first official version is .Net Core 1.0) and does not include all the features of Full .NetFramework as of now.

Features of Asp.Net Core

  1. Though, Microsoft entered Open Source arena with the release of Asp.Net MVC, it is this release that took a very big Microsoft product into the Open Source paradigm completely. Many of best Open source practises are consider in Asp.Net core and it is in fact started using many tooling supports of Open Source community. Asp.Net Core project template in Visual Studio 2015(and 2017) has Bower package manager integration for managing client side packages.

  2. All the framework components are available as Nuget packages to support modularity. Application can be packaged with only required package.

  3. A new Visual Studio IDE called Visual Studio Code is released for Mac and Linux OS for building Asp.Net Core application.

  4. A new cross platform webserver called Kestrel is included by default in Asp.Net Core project template.

  5. Asp.Net Core on .Net Core is modular, meaning it is now possible to add only the packages that are required to run the application. So, it improves performance and the deployment is simpler. It does not require any frameworks to be installed on the environments before deployments.

  6. Best suited for Container based deployments like Docker on Cloud infrastructure.

  7. One of the fastest web stack framework, benchmarks here.

  8. Runs on both .NetFramework and .Net Core.

  9. Web API and Asp.Net MVC are unified in Asp.Net Core. Both Controller now inherit from Microsoft.AspNetCore.Mvc.Controller class.

  10. All static files are kept under a folder wwwroot and it serves as application root on the host for security reasons. The executables are outside this directory and so out of reach from webserver root.

Asp.Net Core - What is Supported and What is Not?

Not every features that the full .NetFramework provides are currently supported by Asp.Net Core. Below are some of the most primarily used features and their supportability in Asp.Net Core projects,

  1. Asp.Net Core only supports MVC. No WebForms support.

  2. Supports building Web API.

  3. No support from building WCF services. WCF client Library support to consume WCF services are available.

  4. No Work Flow Support.

  5. No VB.Net support as of now. It is to be added in future update.

  6. Supports SignalR.

  7. Capable of running under Non-Microsoft OS like Linux, Mac.

  8. Supports Entity Framework Core.

In next article, let us build our first Asp.Net Core project and understand the project templates and structure.

Further Reading

  1. Read Difference Between Asp.Net and Asp.Net Core for a side by side difference.
  2. To know more about the new features in Asp.Net Core, read Breaking Changes and New Features of Asp.Net Core MVC.


Feedback

Comments