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).
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:
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).
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?
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 the 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 corporate 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.
- ASP.NET Core 1.0. Platform. Part 2. ASP.NET Today or what to choose? - December 26, 2016
- ASP.NET Core 1.0. Part 1: Introduction, general description and the future of .NET Framework - December 23, 2016