📜 ⬆️ ⬇️

ASP.NET vNext Likbez

The expected release of the ASP.NET platform (vNext) is one of the most saturated in terms of innovations. But along with all the new products comes a huge number of new specifications, components and other features. At the same time, the .NET world is evolving at such a rate that it’s almost impossible to keep track of all the latest Microsoft web development. Especially if you are still writing on 10-year-old technologies (ASP.NET Web Forms, .NET 2.0) or from a non-.NET world of web development. Perhaps right now is one of those moments when you can skip all versions of previous updates and, starting from scratch, get into a new stream of platform development. Consider the main points for this:


ASP.NET vNext


ASP.NET vNext is the next version of the ASP.NET platform. It is still in development, but the part that has already been presented to the general public shows that there are a huge amount of changes in the platform. The goal of the new release is to create a trend stack for .NET to build modern cloud-based applications.
Key Features:


In addition to the tremendous work on updating the platform, the approach itself has changed how these changes are presented to the community. The social component of the release is very interesting and it became very convenient to follow the platform. In addition to blogs and news in social networks, open preview versions are released where you can perfectly feel the platform. As well as an interesting format of the Community Standup - 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 “from the first person”, almost participating in it. Stand-ups are held in the Hangouts every week and then posted on YouTube.


')

Roslyn


About the new compiler (compiler platform) from Microsoft talk for a long time. The first preliminary version was released 3 years ago (in 2011). But the plans for the compiler are big. First of all, it will also be open source (starting April 3, under the Apache License 2.0). Secondly, Roslyn supports scripting scripts. That is, you can execute pieces of code on the fly. Already started to appear advanced console with support for C #. Roslyn also has its own API for developers to use. Interestingly, the compiler itself is written in C #.

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

OWIN - Open Web Interface for .NET


Perhaps it was thanks to this standard that the changes began from the very foundation. First of all, this is not a platform or a library, but only 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 intermediate layer (Middleware). Its goal is to separate the server and the application, as well as (since the standard is open) to enable and stimulate the development of standard implementations.
What is the practical value? Without OWIN, the entire operation of the application is tied to how the web server (IIS) talks to it. If there is an intermediate layer, then there is no hard binding to the web server, and the web server can be anything that can work with OWIN.

Such intermediate layers can be as many as you want and you can make a separate logic or distributed functionality.

Owin

An interesting point in the OWIN specification is that all interaction between an application and a server through an intermediate 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 mandatory keys defined by the specification. The result of processing is an object of type Task, that is, an encapsulation of the task being executed. For each component based on OWIN, there is a delegate of the application and at run time the server calls the pipeline of such handlers. As each delegate of the application returns a Task, then all components in the pipeline are asynchronous.
As mentioned above, OWIN is just a specification, the rules for which the intermediate layer between the server and the application should work. How to implement it practically or where to get already implemented?

Katana


Katana is one of the implementations of the OWIN specification. Implemented by Microsft, because you can still find the name Microsoft OWIN. As with other ASP.NET vNext related products, the Katana project source code 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 work with the server. No longer need settings and events, such as global.asax. New standard - class Startup. Minimally web application can now be described in several lines.

 public class Startup { public void Configuration(IAppBuilder app) { app.Run(context => { context.Response.ContentType = "text/plain"; return context.Response.WriteAsync("Hello Habr!"); }); } } 


K


As you explore the platform, you will often see 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 in fact the same thing - a new release of the server development platform.

KRuntime - the basis of the platform, an open source software environment . It contains the SDK and runtime itself (more precisely, kvm, kpm, kre).
kvm (K Version Manager) is the manager of the K version of the platform. In practice, a console command for manipulating runtime versions (install, uninstall, change the default version).
kre (K Runtime Environment, less often Engine) is the part that is responsible for compiling, the SDK, all that is needed to run an ASP.NET vNext application. In principle, a specific version of kre goes 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) - input 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('https://raw.githubusercontent.com/aspnet/Home/master/kvminstall.ps1'))" kvm upgrade git clone https://github.com/aspnet/Home.git cd Home\samples\HelloWeb kpm restore k web 

This is actually all you need to do to install the new version of the platform and run a simple application. After executing the last command (k web) you will have an elementary site on http: // localhost: 5001 / . It will take less than a minute to complete the commands.

Try more


ASP.NET vNext CTP 4 and Visual Studio 14 CTP 4 (Community Technology Preview - version 4) are currently released. 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 innovations, you can download Visual Studio "14" CTP 4 (but there are no guarantees that everything will work or that other products will not break down) or run on a ready virtual machine in Azure .

Source: https://habr.com/ru/post/242243/


All Articles