ASP.NET vNext Likbez

The expected release of the ASP.NET platform (vNext) is one of the most eventful in terms of innovation. But along with all the new products, a huge number of new specifications, components and other features come to us. At the same time, the .NET world is evolving so fast that it’s almost impossible to simply follow all the latest web development from Microsoft. Especially if you are still writing on technologies 10 years ago (ASP.NET Web Forms, .NET 2.0) or who is not from the .NET world of web development. Perhaps right now one of those moments when you can skip all versions of previous updates and, starting from scratch, get into a new flow of platform development. Consider the main points for this:
  • vNext
  • Roslyn
  • Owin
  • Katana
  • K


ASP.NET vNext is the next version of the ASP.NET platform. It is still under development, but the part that has already been presented to the general public shows that there are a lot of changes in the platform. The goal of the new release is to create a trend stack for .NET for building modern cloud-based applications.
Key Features:
  • Open source
  • Cross-platform,
  • Fully based on the new Roslyn compiler,
  • MVC, Web API, Web Pages are combined into one framework - MVC 6,
  • Dependency Injection is built into the framework,
  • No dependence on web server and hosting platform,
  • No longer dependent on the super System.Web library

In addition to the huge work on updating the platform, the approach itself has changed as these changes are presented to the community. The social component of the release is very interesting and it has become very convenient to follow the platform. In addition to blogs and news on social networks, open preliminary versions are released where you can perfectly feel the platform. An interesting Community Standup format also appeared - you can ask questions or hear online the developers of the new platform themselves. All this happens in a fun and interesting way and allows you to observe the development of the platform "in the first person", almost participating in it. Standups take place in Hangouts every week and then are laid out on YouTube.


Microsoft has been talking about the new compiler (compiler platform) for a long time. The first preliminary version was released 3 years ago (in 2011). But the plans for the compiler are great. Firstly, it will also be open source (from April 3rd under the Apache License 2.0). Secondly, Roslyn supports scripting scripts. That is, you can execute pieces of code on the fly. Advanced consoles with C # support have already begun to appear. Roslyn also has its own API for developers to use. Interestingly, the compiler itself is written in C #.

As for the differences in work for an ordinary programmer, it is still difficult to say something, theoretically, with the new compiler and the new type of ASP.NET project (the website and the web application are no longer divided into different projects), the compilation timeout and page refresh when changing the source code should significantly reduced. Ideally, we change the code, press F5 and the site immediately in front of us.

OWIN - Open Web Interface for .NET

Perhaps it is thanks to this standard that the changes began from the very foundation. First of all, this is not a platform or a library, but just a specification, a set of rules. OWIN is a specification that defines a standard interface between a web server and a web application.

Often used another name - the middle layer (Middleware). Its purpose is to separate the server and the application, and also (since the standard is open) to enable and stimulate the development of implementations of the standard.
What is the practical value? Without OWIN, all application work is tied to how the web server (IIS) talks to it. If there is an intermediate layer, then there is no rigid binding to the web server, and the web server can be anything that can work with OWIN.

There can be as many such intermediate layers as you like and you can make separate logic or distributed functionality in them.


An interesting point in the OWIN specification is that all the interaction between the application and the server through the middle layer comes down to a single function - the application delegate.

using AppFunc = Func<IDictionary<string, object>, Task>;

The <string, object> collection, which is called the environment dictionary, contains server parameters, request and response. It cannot be empty and cannot be null. There are also some required keys defined by the specification. The result of processing is an object of type Task, that is, encapsulation of the task being performed. Each OWIN-based component has its own application delegate and at runtime the server calls the pipeline of such handlers. Since each application delegate returns Task, then all components in the pipeline are asynchronous.
As mentioned above, OWIN is just a specification, the rules by which an intermediate layer between the server and the application should work. How to implement it in practice or where to get already implemented?


Katana is one of the implementations of the OWIN specification. Implemented by Microsft, so you can still find the name Microsoft OWIN. Like other ASP.NET vNext related products, the source code for the Katana project is open .

If you look at what this means for developers, the answer is that, in fact, the changes concern only the functionality tied to working with the server. No longer need settings and events like global.asax. The new standard is the Startup class. Minimum web application can now be described in several lines.

   publicvoidConfiguration(IAppBuilder app)
      app.Run(context =>
         context.Response.ContentType = "text/plain";
         return context.Response.WriteAsync("Hello Habr!");


As you explore the platform, you will often come across K - Project K, K version manager, K runtime, and even the console command k. What is K?

Initially, the name of the new ASP.NET platform was Project K (possibly K from Katana). The names Project K and ASP.NET vNext are virtually the same thing - a new release of the server development platform.

KRuntime is the foundation of the platform, an open source software environment . It contains the SDK and runtime itself (more precisely, kvm, kpm, kre).
kvm (K Version Manager) - manager of the platform version K. Practically - a console command for manipulating runtime versions (install, uninstall, change the default version).
kre (K Runtime Environment, rarely Engine)- the part that is responsible for compiling, the SDK, all that is needed to run the ASP.NET vNext application. In principle, a specific version of kre is used for a specific application, moreover, you can pack your own version. For your application, kre is just another of the nuget packages.
kpm (K Package Manager) - package manager. Manipulates additional packages that are needed for the application.
k (console command) - the entry point for working with the platform. The main console command to compile, run the application.

To understand how these commands are used in practice, consider the following scenario:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString(''))"
kvm upgrade
git clone
cd Home\samples\HelloWeb
kpm restore
k web

This is practically all that needs to be done to install a new version of the platform and launch a simple application. After executing the last command (k web), an elementary site will hang on your http: // localhost: 5001 / . It will take less than a minute to complete the commands.

Try more

Currently released ASP.NET vNext CTP 4 and Visual Studio 14 CTP 4 (Community Technology Preview - version 4). It seems that this is the latest alpha version and then the product goes into beta. To try how new technologies work and evaluate other new products, you can download Visual Studio “14” CTP 4 (but there is no guarantee that everything will work or that other products will not break) or run it on a finished virtual machine in Azure .

Also popular now: