ASP.NET Core 1.0. Platform. Part 2. ASP.NET Today or what to choose?

Many of us (including myself) have been waiting for the final version of .NET Core and ASP.NET Core. Now the wait is over – a couple of months ago the RTM version of the web app development technology named ASP.NET Core 1.0, has been released. Just a reminder: in early 2016 it was branded as ASP.NET 5. All new features of the new version of the Microsoft.NET platform have been described in general terms. In this article and subsequent articles, you will learn what else can be done with the latest .Net platform. I will also provide a broad description of the web development technologies that Microsoft offers today. To see what is available at the moment, we can just open Visual Studio 2015 Update 3 with the latest version of ASP.NET and Web Tools (VS2015Tools.Preview2.0.1).

Visual Studio New Project

The image above shows that there are two categories of templates for ASP.NET applications, for the recent version ASP.NET Core 1.0 and the updated ASP.NET 4.5.1 that was officially named ASP.NET 4.6. There were lots of discussions regarding the last digit in the version. The choice was between 4.5.3 and 4.6. Consequently, the latter was selected on the basis of the major opinion. A developer that has experience of working with previous versions of the platform might think in the first place that the given template was designed for compatibility and maintenance of previous versions of the technology. At least, it has always been like that, let’s recall Visual Studio 2010/2012/2013. Is it really so? Partially, yes in some ways. Do you remember the image from the previous article? If we keep only content for the web, we will get something like this:

ASP.NET Today - .NET 2016

Therefore, today Microsoft offers two technologies for web app development: ASP.NET 4.6 and ASP.NET Core 1.0. The detailed description of the recent version, ASP.NET Core, will be provided in the subsequent articles. In this article, let’s compare them with each other. Firstly, let’s see what the updated ASP.NET 4.5.1 can offer. Let’s return back to 2013 when the first release of Visual Studio 2013 took place. If some of you may remember, back then we haven’t received anything new in terms of global changes. Yes, there was a so-called idea of combining Web Forms, MVC, and Web API that got the name of “One ASP.NET” but it ran a little bit late (to be more specific, it could have appeared earlier, but it haven’t). Of course, the technologies and libraries have been updated, but there was nothing revolutionary, except OWIN and its implementation called Katana. But what did we really get with OWIN in ASP.NET 4.5.1? Absolutely nothing useful. The only thing – the pipeline got even more complicated, thought it was complicated before. Admit that complication is not reasonable if it does not make any good. The image below shows the schema of pipelines: a standard ASP.NET/IIS pipeline is on the left, the same pipeline is in the middle but with the OWIN specification, if fact, there are two of them, both the right one – a pipeline without IIS and ASP.NET. In particular, the image shows how simple and lightweight is the OWIN pipeline without IIS (click here to open a high-resolution image).

Pipeline scheme

But why did the OWIN specification turn out to be useless and did not bring anything new and essential? Well, it’s because its implementation was far from perfect, it was the beginning of the end of the IIS monopoly for ASP. NET. Implementation of this specification on IIS was not useful, and its external usage is problematic. Why problematic? Because no matter how good the idea is, it must be implemented and properly tested. Of course, there is a possibility to host an application outside IIS, but using a personal server or host (Self-Host) of a conventional console application level is irrational for serious applications. We may be somewhat unsatisfied with IIS, but all the existing administration means (management, diagnostics, logging etc.) of the server, and the experience (bundle of knowledge) cannot be disregarded. Still, the further development of the OWIN specification provided the basis for ASP.NET Core. Despite that, ASP.NET 4.5.1 was updated and got the new version, ASP.NET 4.6. It ought to be mentioned that ASP.NET 4.6 involves the following variety of technologies: Web Forms, MVC 5.x, Web API 2.x, and SignalR 2.x. And this time, Microsoft did not stop supporting the “outdated” technology, but on the contrary, they added lots of interesting and useful things. Let’s take a look at the most important ones.

Support for the HTTP/2 protocol

The new version of the HTTP protocol was added to ASP.NET and .NET Framework 4.6. To use HTTP/2 with ASP.NET, an application should run on Windows 10 or Windows Server 2016; the OS number is not that important, whereas the IIS version is essential – IIS 10 or higher is required. It is important to note that, at the time of writing this post, support for HTTP/2 has not been added to ASP.NET Core yet, but it will be for sure. HTTP/2 is a new version of the HTTP protocol, that provides more effective communication (less round-trip cycles between client and server) and delay minimization during loading of a web page for users. HTTP/2 provides a maximum advantage for web pages (in comparison with services) since it optimizes the request of various artifacts during one operation. All work is done by a browser and web server (IIS in Windows). There is no need to shift the burden on users. Most of the browsers (new versions) support HTTP/2, and it’s likely that users will be able to take advantage of the HTTP/2 protocol if it is supported by a server. For more information on the new protocol, please refer to this link at Channel 9. In my opinion, it is an essential update for ASP.NET 4.6.

Support for .NET Compiler Platform (“Roslyn”) in ASP.NET.

As for me, this is another great improvement. In short, I’d like to mention the most important improvement that we have when using Roslyn – compilation speed. In addition, there are new possibilities of programming languages, though I consider them to be of little use so far. To get more information on this issue, you can refer to this article.

Other improvements and updates in ASP.NET 4.6.

This paragraph lists less important but still quite useful improvements and updates. MVC 5 and Web API2 were updated to version 5.2.3, minor improvements and bug fixes were made. Asynchronous Model Binding was added in Web Forms, controls were updated to support Entity Framework 6, the Ajax Control Toolkit library was updated. The entire list of updates can be found in this article. Also, I would like to mention one more improvement – a new 64-bit JIT compiler, that is not directly related to the ASP.NET 4.6 platform, but it is used by it. NET Framework 4.6 features a new version of JIT compiler that has much higher performance than the existing 64-bit JIT compiler. So, we may conclude that the number of changes and improvements is quite impressive, which makes the ASP.NET 4.6 platform quite up-to-date. And of course, there will be more improvements in the future.

What about the brand new version of ASP.NET Core?

Here, I will briefly list the most notable features that will be described in more detail in the subsequent articles. Much faster and more lightweight execution environment. The possibility of hosting an application anywhere and anyhow you like – there is no strict tie-in to IIS anymore (though this possibility was introduced a bit earlier, but it was not that convenient and complete, as I noted above). Full modularity owing to key changes and .Net Core. As for the cross-platform feature (possibility of hosting applications outside Windows, in this case, these are Linux and Mac OS), no matter how widely it is advertised, I do not consider it a key change, though I may be wrong. I can hardly imagine a developer who uses everything from Microsoft shifting from ASP.NET to another OS. However, it is possible that developers who use other platforms will use ASP.NET Core outside Windows. Of course, there are other alternate and worthy technologies there. The possibility of configuration and deployment has been much simplified, but shifting to JSON is hard and not convenient for developers who have been working with XML for a long time. Today, JavaScript libraries and platforms widely use JSON-based approach, it is much more convenient to have something like this on the server side. One stack for both, user interface (Web UI) and API is more reasonable in comparison with two stacks. However, back then, the task was to make a separate technology for the creation of the HTTP services, which could be developed separately from ASP.NET/IIS, but this ambition apparently failed. Also, the new means that simplify the process of application diagnostics were added. All mentioned above makes applications on ASP.NET Core more cloud-friendly (Cloud Optimized ASP.NET), and as we know, cloud technologies now play a big part and will play yet bigger part in the future. And finally, I’d like to point out that all the mentioned changes appeared owing to the fact that the platform was rewritten almost from scratch taking into account the existing experience and modern requirements.

So, we have lots of new features and improvements. But what do all of us who use this platform get with this new technology? All my experience suggests that to build a “correct” application, technology takes a back seat and in most cases does not play the leading part. That is, if a developed application does not solve (or solves poorly) the intended problems, even the most advanced technology will not help to fix the situation. Five years ago, the so-called “front-end” developers (under this term I mean not a layout designer, but a developer who is an expert in JavaScript, different libraries, and JavaScript-based technologies) were not taken seriously. Now the situation is completely different. Writing JavaScript code is no easier, and sometimes even harder. JavaScipt is a ‘soul’ of the web today, and you can’t disregard it. Regardless of whether we want it or not, the approach when HTML was generated on a server with the help of the server technologies becomes less and less popular, and there’s a reason for this. A web application today is something bigger than it used to be 10 years ago. First of all, it brings complexity that becomes unreasonably high if we use server technologies, such as ASP.NET Web Form or ASP.NET MVC for implementation of the logic of a complex and interactive application on a client instead of, let’s say, JavaScript. Until today, Visual Studio couldn’t offer anything what, for instance, WebStorm has in terms of ‘front-end’ development (developers who work with WebStorm will understand me). And using ASP.NET exclusively as a server layer is not always reasonable, if we take alternate technologies into account. With ASP.NETCore the situation changes, though the functionality for SPA in comparison with WebStorm, in my opinion, still remains limited. Perhaps, I’m too critical and I could get away with existing capabilities of Visual Studio, but it’s terribly inconvenient. For instance, there were no built-in means for working with Gulp or Grunt before Visual Studio 2015 and ASP.NET Core. Therefore, I’m glad about lots of options and features in ASP.NET Core. So, let us be pragmatic, and having two technologies for web development at hand raises the following question:

What should we do, what is our choice?

In this case, the choice is anything but simple. If you have a desktop ASP.NET Web Forms application and lots of available resources (funds), migrate to ASP.NET Core. If your resources are limited, I recommend making gradual migration to ASP.NET 4.6. With the ‘One ASP.NET’ idea, you can do it step by step: leave old code here and MVC there. As for the parts where productivity is critical on both, client and server – use a single page approach (SPA), for instance, with by means of AngularJS. I and my developers did something of the kind, I have experience in migrating corpoate web portals from ASP.NET 3.5 to ASP.NET 4.6. To tell the truth, it is not that simple as it seemed: there were too many pitfalls that were partially caused by the code quality. If your code does not meet your needs, you should think of it, not about the technology or platform. If you have an ASP.NET MVC application, it is worth switching to ASP.NET Core in the following two cases: if your application has problems with productivity (and you’ve done everything about it, and there is nothing left to optimize), or if you have lots of money spare time. Otherwise, you need to improve your code. There are cases when the code is tightly bound to System.Web.dll and IIS, and this is a good reason for not touching anything. And here is the last case: if ASP.NET is used solely for web services, for instance, in the case with Web API. Examples are single page applications (SPA) or distributed applications that may have no relation to HTML. In such case, switching to a new version is much easier. Still, if you are satisfied with everything, there is no need to switch to ASP.NET. In most cases, it is enough to update .NET Framework to version 4.6. I know applications and people that still use traditional ASP and are happy with it. If you are not satisfied with the productivity of Web API and IIS, it is the good reason for updating to ASP.NET Core.

Now it is time to answer the main question, which is: What is our choice, ASP.NET 4.x or ASP.NET Core? There is no absolute answer to this question, it depends. It is your choice, and you should remember that future belongs to ASP.NET Core and it will come sooner or later.

 

Karen Tazayan

Karen Tazayan

ASP.NET Developer at Altacode
Karen Tazayan has 7+ years of experience in software development, testing, troubleshooting and implementation. He has strong knowledge of technical specifications, workflow development, and QA. In-depth understanding of project management and application lifecycle management (ALM).

Since 2011, Karen has been an active member of MSDN community and participated in MSDN forums as a moderator and leads his own blog about .NET Framework, software development, debugging, and diagnostic tools. Karen is a Microsoft MVP since 2014.

Karen is an active speaker in the events which Microsoft organizes in Armenia and Georgia.
Karen Tazayan

Karen Tazayan

Karen Tazayan has 7+ years of experience in software development, testing, troubleshooting and implementation. He has strong knowledge of technical specifications, workflow development, and QA. In-depth understanding of project management and application lifecycle management (ALM). Since 2011, Karen has been an active member of MSDN community and participated in MSDN forums as a moderator and leads his own blog about .NET Framework, software development, debugging, and diagnostic tools. Karen is a Microsoft MVP since 2014. Karen is an active speaker in the events which Microsoft organizes in Armenia and Georgia.

  • Great article. Thanks for sharing. The article is well written and extremely detailed on which path to take if a .net developer is on the fence about 4.6 or core.

    • Karen Tazayan

      Thank you! I see some errata, also there is the schema of ASP.NET pipline in English. I’ll ask to replace the links.