Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Unboxing the ASP.NET 5

0.00/5 (No votes)
15 Nov 2014 1  
This article provides an overview for the ASP.NET 5 a.k.a vNext, its features and the new stuff for the developers and audience.

Introduction

ASP.NET's 5th version is out alongwith many new features from Microsoft, which includes Visual Studio Community 2015, .NET core to be Open Source and the main thing is the new framework for the ASP.NET and the major things in this releases is to prevent the time wasting in compiling, building and deploying of the applications to the hosting environment; Cloud or any other medium.

This article would discuss the overview for the services that are included, added and/or fixed in the 5th update to the ASP.NET. 

Overview

Lets first get an overview of the things we are going to dig deeper right away in the article to understand the core features of them and the requirement of them in the "Modern Web". 

Platform - Mobile, Tablet, Computer and Laptops etc

In Modern Web, users are not only asked to be sending a web request to an application on the Internet through a computer to use the service they're providing. Instead, they're having smartphones, like Android, Windows Phone or iOS powered phones which are capable of stuff computer can perform. That is why, there is no need to show any sign of "Please visit our website from a desktop to use our services". 

Mobiles phones such as Android use WebKit engine for better performance in rendering of the websites, so you can stream down better quality graphics and write good dynamic website codes using JavaScript or any of its libraries to build good designs for your dynamic websites. Single Page Applications is an outcome of JavaScripts and many webites allow this feature on their mobile version too, Facebook has this. 

Responsiveness

Website's responsiveness means that how well a website is for the readers and how good the UI and the UX are, relative to the reader (user; client). 

Websites are created responsiveness, using CSS3's media queries, JavaScript or jQuery to check for the screen or the device properties and then work on them to make sure each device and screen gets a better view for the content rather than the data or the web content being broken down and a bad UI. 

Using CSS frameworks, like Twitter Bootstrap, which is a framework built over JavaScript and CSS for a better website UI, or responsiveness. Tableless website is also an example of this, where you don't need to put your content inside the tables and so on and so forth...

What does ASP.NET offer in Update?

Before we dig into ASP.NET, lets take a deep breathe and explain what ASP.NET is, for those who are unaware of ASP.NET itself. 

What is ASP.NET

ASP.NET is an open sourced (well, since this version onwards the ASP.NET is an open source project; it has been open source since its last version but this version is open sources since the beginning of it) server-side programming language developed by Microsoft to run on any platform (first it was Windows; now ASP.NET can run on any platform from Windows, to Mac all the way down to the Linux), to let the programmers build websites and web applications to be hosted on servers and on the Cloud. 

Major function of ASP.NET was to build the web applications, websites and web services that would be hosted in the Cloud, Azure for example. But now adays it is being used by developers who create indie websites and host them on their computers, many develop do.

ASP.NET logo

ASP.NET vNext

There has had been ASP.NET vNext in the news for a time and now ASP.NET team has released a new updated on their blog that the ASP.NET 5 is out and ready to be used.

This update includes many fixes that mostly Microsoft products are offended for. It is now Open Source. The source code for the ASP.NET project is now available for using on the Git repository.

No more ambiguity

By the term ambiguity I meant the difference between MVC, Web Pages, Web Forms and Web API. Mostly new developers are confused for using which one, and they ask questions on different forums, to use which service as per their needs. The ASP.NET team now has solved this question themself and have merged the Web API and MVC into one, and have called it as MVC 6. Web Pages is also to be merged into the MVC model. Leaving only Web Forms to be left behind, for you to ask questions about...

ASP.NET as whole

Features

Now, time for the things about ASP.NET's 5th version, that are shipped in the package that we would download and use for our later projects. 

If we start reading and digging into the core features that ASP.NET supports now, it will be a huge list, so why not just group up the chunks of the features into a bit bigger ones and then read then and understand the interesting concepts provided by ASP.NET team in their updates. 

Client side performance

The client side performance and code execution has been a good part for the ASP.NET programming, Web Forms has been developed to control the client interaction with the website or web application. 

Mobile - Tablet support

Since the beginning, there has been a great support for mobile devices, compression, and IIS caching services to improve the web application performance in the mobile platforms or to show the web pages in the mobile device responsively. 

Responsiveness

"Modern web" wants every website or web application to be as much responsive as it can be. This enables the users to understand the website's functionality and purpose in a better way, rather than for him to scroll or scale the web page. 

CSS3, jQuery and other stuff was to be used in order to provide this functionality, but ASP.NET has taken over this one task too. ASP.NET has joined hands with client-side frameworks to control the client-side behaviour of the website. 

Client-side frameworks

Angular.js and other client-side frameworks for the better UI and interaction of the web app are used widely for a better UX, and so... to enable the web developers to write application in 100% ASP.NET, the team has provided frameworks to work in the client-side as well as server-side. Grunt and many other frameworks has been built right into the Visual Studio 2015. You can directly push new content to the Browser, I'm not joking. 

In Visual Studio 2015, your web browser and the IDE are connected, so any change you make through the Browser (inspector) is pushed back to the Visual Studio, and from Visual Studio directly to the web browser. 

Cloud ready

Although ASP.NET was built for the Cloud since the beginning, but has been widely used in the web applications for general usage and Cloud was left all alone. Microsoft has now create Azure and recommends using Azure to the developers for better performance. 

The trouble in pervious versions...

ASP.NET was built to reduce the time for execution of the code. Web Pages is an example of such website. You would just write the code, save it, reload the page in the browser and the new code would execute. This is known as JIT compiling; "Just in Time compiling" and many more names it holds. 

But while developing Web Forms, MVC applications and other ASP.NET projects, you were required to build, compile the project and then the Browser would open a tab with location to your resource and the new code would work for you. This, would take on ordinary as well as developmental machines up to 5 - 7 seconds or more depending on the project and machine. 

Also, if the project was hosted in any other environment, the programmer was asked to download the entire project, edit and make changes to it. Once done, he would deploy the application on the server to show the changes on the server. 

Whats in the new version?

The new version of the ASP.NET is found to include a lot of fixes; I have said a lot of a lot of times. Major one is the lesser or, to be frank, no compilation of the source code at all. You write the code, save it, reload the see the latest changes in your code in the Browser. 

Yes, that is the case. That is so, because when you're saving the code, the Visual Studio would automatically check for the changes and would process only that part, and dynamic compiling would work its way to save the code in the memory for the clients to access. This also causes a faster start up for the applications by helping the CPU to compile once and use everytime.

This problem arose inside the Cloud, where deployment, development and all other stuff took a lot of time of the developers and then the compilation time would cause a havoc of ~7 seconds. ASP.NET has now the solutions. A few months ago they updated the assemblies of the ASP.NET project to take upto 60% less CPU and 80% less processing time, and now, the compilation has been removed and the memory consumption has been cut short more than 90%. This is a great thing to have for a better performance, don't you think?

Use the power of the Cloud

In this version, the debuggin, compiling, loggin and stack traces, every single thing remains on the Cloud. You don't even have to download the source code to edit, Clouds provide an interface for source code editting, Azure has one. Where you can easily edit the source code, and upon hitting the Save button the latest code is already made publicly available for you. 

So, you create the connection states in the clouds, you manage each and every session on the cloud and you configure your web applications to suite the required design of the environment and devices on the cloud. Applications are cached to improve the performance of the applications, this allows the developers to maintain the sessions and states and performs tasks at a better speed, rather than working on the basic functions like getting out the UserID, or the DateTime stuff etc. 

Develop using any Tool

ASP.NET is not only open source, it can be developed using any tool, Visual Studio is some what favourite among the developers, but if you're having any other IDE, ASP.NET would be happy to work with it. 

Not only this, there are many third-party tools and frameworks ASP.NET has been compatible with. Next topic would cover this section in detail and would cover itself too. 

Cross-platform

The ASP.NET is not cross-platform. Making it able to be run not only on Windows, but on Mac and yes on Linux too. The project is now made open source so that developers can use them anywhere they want even if Microsoft is unaware of the project; doesn't happen usually. 

Building on a Mac

Well, there have been a good thing in ASP.NET that it is now able to run on Mac, there aren't many articles and I haven't tested any ASP.NET project on Mac; because I don't have one, but Microsoft team is already up to this problem too. They have also written a good article on their blogs.

Getting contributions

The previous sub-section, "Building on a Mac" was not only a Microsoft work, but many other people contributed to it. Not only the ASP.NET development on Mac is the one thing, but there are other third-party tools, like the one Yeoman thing being used to compile the ASP.NET project on the Mac. 

Microsoft is also found taking a keen interest in giving out contributions, the Android applications, Android emulator for Visual Studio and many more is a big step for Microsoft and it succeeded; atleast for me. 

Hosting the service

Hosting the ASP.NET application is a big issue, IIS is a Windows-only product by Microsoft since it was developed for their own web server. They're not yet ready to develop an IIS for Mac or Linux, but they're tried to enable the developers to host the websites without using IIS at all. 

This blog post of ASP.NET team shows this process in detail, how you can host ASP.NET application without IIS, you would require to edit the project.json file. 

This feature removes the IIS-required warning sign from your mind, and enables you to host your ASP.NET website on any hosting environment. I remember I had to look for a Windows-hosting service to port my website to, and I feel bad that I didn't have this at that time. 

Project.json

In the previous sub-section I have had said, that you can compile and run the ASP.NET project on any hosting service, so what if I don't have the Visual Studio to understand the requirements for the web application, hosting service, .NET framework version etc? What would have happened?

To minimize this issues, this time each project is created with its project information and required information along it is written inside the project.json file. This file contains all of the information about the dependencies, assemblies, frameworks (both server and client-side) and all other stuff that the project requires. 

So, the above file makes it possible to be compiled through a command line. Pretty nice though. 

Project.json file

No need for a full package

In this update there is another major thing added, that you don't really need to use the entire framework of ASP.NET to run just a personal blog. You can check the things that you want to use in your application or website, and just use them remove all other un-necessary things from the project. 

This is also known as "being modular" in ASP.NET. For example, the Sockets, Services are of no use for a simple web blog of a person, you can turn them off from the project to remove them completely. And just use those features that you want in your website or application. 

This is also known as the HTTP request pipilining feature in ASP.NET. Enables you to add only a few components. This makes your website perform better by sending/recieving only the data related to your application. 

Running multiple frameworks

ASP.NET 5 introduces two frameworks, a new framework is the ASP.NET Core 5. ASP.NET 5 makes a use of .NET framework whereas the ASP.NET Core 5 is the framework that is used to process the ASP.NET applications on the Core ASP.NET framework without affecting any of the applications that are running on the other environment or framework. 

You simply define the dependencies inside your application project. This feature enables you to use the latest version of the framework for either application and stick to the older framework for anyone. 

Points of Interest

There is more to come in ASP.NET. ASP.NET is now an Open Source server-side language for the Cloud hosted web applications. 

Visual Studio 2015 would be the best IDE since it is connected to the Browser directly, enabling us to change the UI dynamically and on the runtime.

The compile-time and the building of the solution has been minimized and enable the developers to write, save and see the changes inside the Browser. 

Cross-platform support has been added to the ASP.NET, and you can host your applications on almost any environment. Visual Studio is not available on Mac and Linux, so project.json file is added for you to compile your source code from a command line. 

History

First version of the post.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here