by Bartosz Borowiecki

The all new ASP.NET vNext

Finally, after a long time Microsoft severs ties with IIS, ASP.NET WebForms and System.Web.dll. Their newest tech – ASP.NET vNext is coming.

ASP.NET WebForms  was introduced in early 2000s. It seemed like a good idea at the time – easy transition from WinForms, nice controls and separation of markup and code for better source management. But the Internet technologies change very quickly, every year brings new ideas and solutions.  Soon it became apparent, that the main problem was that ASP.NET was part of the .NET framework itself and it could be only updated along the framework, meaning, not often.

First change came with introduction of the MVC. It was created on top of ASP.NET, not as a part of the framework. It allowed MVC framework to develop faster than .NET itself. MVC is now deployed with website, meaning that different sites can run on different versions. It still relies on ASP.NET, though, so each site references System.Web.dll from ASP.NET. This is one of the biggest assemblies in framework, which means longer loading times, bigger memory consumption and dependence on IIS.

Next big step in ASP.NET evolution came with rising popularity  of RESTful services. Developers needed a new solution for RESTful services, not relying on ASP.NET or an IIS. Microsoft responded with WebAPI, that had no dependency on IIS/ASP.NET. It meant faster loading times, less memory consumption and most importantly – self-hosting.

Why not self-host everything?

Developer community has seen benefits of self-hosting/IIS independence very quickly and wanted more technologies to support that – mainly MVC. It would be a lot of work to write and support a host for every current and future technology, so Microsoft created Open Web Interface for .NET (OWIN) – a standard interface between .NET web servers and web applications. Along with the standard, Microsoft released Katana – their own implementation of OWIN.

The main point of OWIN is to decouple server and application and to create a framework in which each piece of functionality is encapsulated in independent module. This means one can tailor a webpage/service/host as needed, without unnecessary loading time and memory consumption. Each module can be easily switched changed and/or updated without affecting the others, meaning new functionality and bug fixes will be available for use very quickly. Simple hosting environment is also easy to move/replicate on others platforms – like Mac and Linux.


WebAPI was the first one to support OWIN as it was already self-hosted. Next step was pretty obvious. As popularity of MVC is rising and WebForms are on the decline – Microsoft decided to leave that part of ASP.NET behind and only rewrite parts needed by MVC. Don’t worry, WebForms aren’t forgotten, they’re still supported, just not compatible with OWIN hosts (meaning they still need IIS to run). Moving away from IIS and .NET framework allowed for a few interesting changes.

New project file and K Runtime

The first thing we will notice while creating a new site is lack of CSPROJ file. All needed information is stored in project.json and now. This change ensures that we don’t need MsBuild to build our site. New project file is really simple – the most basic version contains only information about framework that should be used to run application and project dependencies.

A framework that should be used? Yes, .NET is no longer the only framework. With the new ASP, comes K Runtime Engine. KRE basically bootstrap and run an ASP.NET vNext application. Along with it comes KVM – K Version Manager, whose only responsibility is to manage KRE and dependencies versions. It means that KRE can exists side-by-side with other versions of itself without any problems!


So, the new project file defines dependences, but in a different way compared to old CSPROJ. It uses NuGet internally. Each module is a NuGet package. Even the Runtime itself is a NuGet package! What’s more you don’t even need to have them on the disk! KVM will download and load them for you! This means that you even can deploy your site without them and let the platform take care of it. Each dependency can be defined with exact version number if needed, meaning there will be no surprises – all your development, test and production machines will have exactly the same environment!

It’s also worth noting that each feature is now a small module. You want to use IIS? There is package for that! Cookies? Yes. You want to serve static files? Guess what?! There is a separate package for that too!

The new compiler

Next thing that captures attention is Web.config. Or rather lack of it. No more big configs with a lot of XML. All that needs to be configured is set up from code. “From code” you say? “Useless! – I will have to rebuild project after each change!” Fear not – ASP.NET vNext uses new Roslyn – all assemblies are build and loaded to memory in real time. They even don’t need to exist on hard drive! Just change something in code, hit refresh and voila!

All packages are preconfigured by default, which means that they can be set up and used really quickly. You’ll only need to configure special cases. Additionally, many of them uses functs as parameters for configuration – all setting up can be done with few simple lambdas!

Dependency injection, MVC and WebAPI unification

New ASP.NET provides DI out-of-the-box. In previous versions DI was partially supported, usually with some outside container. Now, DI is built-in and available throughout the entire stack! It’s really easy to attach some outside container (it’s Bring Your Own Container), but framework provides a simple one and it’s enough, if you don’t need some advanced injection capabilities.

To maintain separation of ASP.NET and WebAPI, the latter implemented its own base class for controller, different than MVC controller. This allowed the self-hosting and independence from System.Web.dll. Now, the whole framework is independent, so merge of MVC and WebAPI was pretty obvious move. WebAPI no longer implements its own controller (ApiController), but uses base MVC controller class. It’s also uses the same routing now, so you can have one class for all your MVC and API needs.

Open source

Last, but not least, feature – it’s open source. From the early alphas, all code is available on GitHub, you can even create pull requests. Thanks to self-hosts and independence from II, you can set it up on Linux or Mac machine. Any host compatible with OWIN can be used.

The ASP.NET vNext seems to be a response to current trends in web development. Developers will get a lightweight and modular framework that is independent from ASP.NET/IIS. It will be easy to tailor this framework to our needs and add to it. With all modules being NuGet packages and built-in version management, deploying, updating and extending will be effortless. Separation from .NET framework will allow vNext to develop very quickly and respond to web developer needs. All in all, it’s a very promising technology!