Thoughts from the Wet Coast

The musings of an ASP.NET Developer from Canada's We(s)t Coast

ASP.NET 5: 1 - Introduction

Category: ASP.NET
Last Modified: May 2 2017
Oct 28 2015

Almost a year ago I posted the first post in a new series of blogs on ASP.NET 5.  As it happened that post ended up being the only post as my work commitments meant that I wasn’t able to dive into the new features of ASP.NET 5.

So, now that I have some free time, its time to get back to the topic of ASP.NET 5.  Although ASP.NET 5 is still in Beta (Beta 8 is the current release), it is scheduled to be released in the first quarter of 2016, so the features are much more stable than they were in late 2014.

Rather than being an evolution of ASP.NET 4.x, ASP.NET 5 is a total re-envisioning of the ASP.NET stack, rebuilt from the ground up, with a number of foundational changes.

  • new lightweight, modular HTTP pipeline
  • can be hosted on IIS or self-hosted
  • built on .NET core
  • ships entirely as Open Source Nuget packages
  • built in support for dependency injection
  • can run cross-platform on Windows, Mac or Linux


Startup class

ASP.NET 5 applications contain a class called Startup which has two methods.

public class Startup {      public void ConfigureServices(IServiceCollection services)      {      }       public void Configure(IApplicationBuilder app)      {      } }

The ConfigureServices method is used to define the services your application uses, while the Configure method is used to define the middleware which makes up your applications request pipeline.


A service is a component that your application uses.  Services are resolved in your application using dependency injection.  The ConfigureServices method is used to do any initialisation or configuration of your services and add them to an Inversion of Control (IoC) container. ASP.NET 5 contains a simple IoC container but this can easily be replaced by an IoC container of your choice, such as Autofac or Castle.


In ASP.NET 5, rather than defining HttpModules in your web.config file that can be invoked as part of the request pipeline you can “use” middleware.  The middleware you use can be configured in the Configure method of the Startup class.

Typical middleware components are used for:

  • Static Files
  • Routing
  • Diagnostics
  • Authentication

Just as with HttpModules you can define your own middleware and invoke it in the Configure method.

This is a brief introduction to the major new concepts in ASP.NET 5.  Check back as I dive deeper into building an ASP.NET 5 Application.


The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.