ASP.NET 5
“A lean and composable framework for building web and cloud
applications”
ASP.NET now
Built upon a monolithic .NET 4.* framework
Slow release cycles
BUT! Stability is not an issue – good quality and cohesive, unified platform
Typically one FW version installed / machine – is that really an issue in the public cloud?
Well-defined set of events in the HTTP request pipeline
Extensibility through Modules, Handlers etc.
Goes hand-in-hand with IIS
How do you innovate when stability has to be maintained on millions of devices without
introducing a breaking change?
ASP.NET 5 Concepts
Cross platform
Modular
EntityFramework
Mvc
Antiforgery
CORS
Diagnostics
Identity
Caching
Routing
IISIntegration …
ASP.NET 5 Concepts
Truly Open source -– check repos at github.com/aspnet
not only “source opened”, public GitHub repos with issue tracking
non-MS contributors participate, community members can (and do) send pull
requests
ASP.NET 5 Concepts
“Why did you open source the new ASP.NET?”
Why not?!
An attitude / strategy change at Microsoft towards “Mobile first, Cloud first”
ASP.NET 5 Concepts
Deeply inspired by Node, Ruby…
Run your code anywhere, with any runtime (NVM, RVM)
Light-weight, componentized frameworks
Fast iteration cycles during development
Provide a strong REPL experience - coming to C#
Web app hosting is not tied to IIS – Kestrel, IIS, WebListener
Wide palette of dev tooling – still best quality IDE support on Windows! Don’t fear the CLI
Composable and minimal – achieve high performance
If you need a raw TCP socket, so be it
Cloud-ready + rich tooling in Visual Studio 2015
Right click, Publish… experience further improved
Azure Web app, Docker on a Linux VM
Dev stack comparison current vs vNext
Current ASP.NET stack
ASP.NET 5 Development stack
.NET Core = CoreCLR + CoreFX
CoreCLR = .NET Core Runtime + mscorlib
CoreFX = foundational libraries
GC, JIT compiler, base .NET data types, low-level classes
collections, file systems, console, XML, async, SqlClient…
https://github.com/dotnet
/coreclr
/corefx
Works with ASP.NET, that’s OK. But console tools as well
Even more: on Connect(); event native compilation was announced!
This means .NET native on Windows, Linux, OS X
ASP.NET 5 & .NET Core are RC
What does it mean? Far from RTM?
Working on ASP.NET 5 for ~ 2 years
“Go Live” support for prod systems
Feature complete
No breaking changes are expected in code, only minor API changes
RC 2 will come until 2016 – DNX will be sliced into 3 pieces
RTM is expected by the end of February 2016
Further performance improvements are to be expected until RTM
Full .NET FW vs .NET Core
Which to choose when?
.NET Core
Cross-platform – Windows, Linux, OS X,…
Deploy FW with your app – multiple FWs on the same machine
Runs in its own isolated unit – unaffected by system-wide patches
Microsoft puts huge invests into it, innovation takes places here easier
You want a fully open source stack
Full .NET FW
Reliable & fault tolerant production grade applications
Windows-heavy applications
When cross-platform is not an objective
DNX
SDK + Runtime environment = all you need to build & run .NET on any platform
Managed entry-point discovery
Host process for your .NET application (ASP.NET & console app)
provides a set of services to applications through DI e.g.:
IServiceProvider, IApplicationEnvironment, ILoggerFactory
Hosts the CLR
Different “flavors” (CoreCLR, Mono, Full .NET FW)
Open source friendly
load dependency’s source instead of binary build in-memory debug
“Develop on one platform. Run it anywhere”
How to obtain it?
DNVM – 1: .NET Version Manager
Manage installed DNX’s on a machine
Strong resemblance with NVM and RVM
How to get?
Windows: part of tooling that comes with AspNet5.ENU.RC1.msi
OS X / Linux
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh
| DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
What you get? Just a bunch of PS / bash scripts
DNVM – 2: command line tool
Available DNVM commands
DNVM – 3: How’s a DNX installed?
dnvm install latest –r {RUNTIME FLAVOR}
Runtime can be: coreclr | mono | clr
DNVM – 4. Choose an installed DNX
dnvm list
Just a text file in .dnx/alias
folder
dnvm use
Persist: adds to user path as well
Hosting – IIS or Kestrel or…
Kestrel is a .NET based cross-platform web server
Built on top of LibUV
Cross-plat C library
Asynchronous IO & Networking
Used by NodeJS as well
On Linux and Mac Kestrel: command line with DNX
On Windows
Kestrel: command line with DNX
IIS: bit different than what we get used to so far
not in-proc in IIS, ASP.NET runs in its own process (dnx.exe)
IIS creates process, forwards request to it etc.
How to get started?
get.asp.net
Windows
1.) Install VS2015
2.) Download the ASP.NET 5 RC1 installer – runtime + tooling in a single MSI
3.) dnvm upgrade
4.) File – New Project…
OS X
1.) Get DNVM with CURL
2.) If you’d like to use Mono install it with Homebrew
2.) Get DNX for CoreCLR or Mono
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
dnvm upgrade -r coreclr
New Project Structure
wwwroot – JS / CSS / HTML
References - .NET assemblies
Dependencies – NPM / Bower packages
Multi-Targeting
global.json
project.json
.xproj, .sln
appsettings.json
global.json
projects [ ] – which folders contain source code?
sdk { } – which DNX version is targeted?
project.json
wwwroot location
Application version
.NET Dependencies
Commands
Target frameworks
Exclusions
Scripts to run
project.json – project.lock.json
Not for humans
Project.lock.json – flatten dependencies, write means recalc, just like Gemfile.lock
Framework multi-targeting
JSON object in project.json
With .NET Core frameworks are just folders on disk
C:\users\gkovacs\.dnx\runtimes\dnx-coreclr-win-x64.1.0.0-rc1-final
Compile for both .NET and .NET Core from the same project type in one step
Separate dependencies for each target FW in
Solution Explorer
Different icons for NuGet / binary / FW assemblies
Commands
Support for command line tooling
Supports simple invocation of a managed entry point
Can be invoked with DNX
Example: Start Kestrel Web server
When packaged, Commands are made into PS / bash scripts
DNU – .NET Development Utility
Build a project – produce assemblies from source
Package feed configuration (nuget.org, MyGet, VSO,…)
List dependencies of a given project
Create a NuGet package from a folder
Publish
Restore packages
Wrap csproj -> project.json
Dependency management - NuGet
NuGet everywhere – each project is made into a NuGet and
referenced like that
View the transitive dependencies in a hierarchical view
Same JSON property whether it be NuGet, assembly ref, source
from an open source project whatever else
“I have a list of deps, but I don’t care where they come from”
Dependency mgmt. – Bower & NPM
Application Startup
Convention based entry point in Startup class’s Configure() method
Configure()
ConfigureServices()
Startup.Configure()
Injected through the DI container
HTTP request pipeline – 1. Overview
HTTP request pipeline is fully customizable
Middleware concept – you define your own events
HTTP request pipeline – 2. Simple example
Two very simple example for middlewares
Use() and Run()
Run accepts a delegate with no
“next” reference in its signature.
Becomes always the last one in the
pipeline
HTTP request pipeline – 3. Customization
Customizable to the last bit – “Only get what you’ve paid for”
Static File handling (yes, even that!)
Dev time: BrowserLink
Dev time: Exception & DB error pages
How does it come to IIS?
How does it relate to OWIN?
Migration is supported (Katana interface is similar,
IAppBuilder)
Has OWIN compatibility, but ASP.NET 5 itself is NOT built on top of OWIN
Configuration
Where is my web.config?
A Code-based configuration approach
ConfigurationBuilder class
.AddJsonFile()
.AddEnvironmentVariables()
Environmental awareness – built-in support
for multiple environments
Dependency Injection
ASP.NET 5 has built-in DI support for basic scenarios
Core to ASP.NET, own FW’s like MVC use DI to get their components can replace with
your custom easily
Typically through extension methods in Startup.ConfigureServices(IServiceCollection
services)
Transient – new instance each time when requested (light-weight & stateless)
Scoped – once per request
Singleton – created on first request, then same instance is served in subsequent requests
Instance – add a single instance, non lazy loaded compared to Singleton
MVC 6 - Brief
A fusion of Web API and MVC
Using the same routing / filters / dependency injection…
Follows the ASP.NET 5 philosophy
Just step in Startup.Configure()
MVC 6 – Tag Helpers
Razor (no CSS IntelliSense in @class as we’re in C#)
Tag Helpers
Same equivalents of HTML Helpers
Using HTML Attributes instead of C#
EF 7 – Brief
Light-weight & extensible
Supports different OS’es
Supports different DB technologies (e.g.: SQLite on OS X)
Not only for relational DBs: Azure Table Storage & Redis
Removing: EDMX, ObjectContext, MEST, very complex type <-> table mappings
Performance
github.com/aspnet/benchmarks
TechEmpowered
PlainText benchmark
Sends back “Hello World”
Goes through the HTTP pipeline (routing, etc.)
(ASP).NET perf on Win vs Linux?
Deployment – Visual Studio tooling
File System
Docker on a Linux VM: right click, Publish
Azure Web App: right click, Publish
Deployment – Visual Studio tooling
Content to be published
Invoke MSDeploy
Tools for Cross-Platform Development
VSCode is always a fine option on OS X & Linux
No .xproj, .sln files required – completely decoupled from Visual Studio
OmniSharp -> not only in VSCode but Sublime, Emacs…
Determines runtime
based on global.json
Parses discovered
DNX projects to
provide code editor
services
Tools for Cross-Platform Development
X-Plat is not easy
Max path restriction (solved)
Console.Color ???
Eventing – no ETW other places, some analogue is found, usually OS es have
same needs but implemented differently – same exp is provided
SqlClient and ADO.NET had lots of native dependencies on Windows, built ~10
years ago. Porting was a P.I.T.A. SqlClient almost completely rewritten in C#
to support other OSes
Hard to achieve a dev experience like VS on other OS’es
Exception handling / (async) debugging / interactive windows / live perf view /
BrowserLink / designers…
Resources
Try it at home - get.asp.net
Books – not yet
Read the docs - docs.asp.net
Channel9, MVA courses…
Check the source
github.com/aspnet
github.com/dotnet/coreclr
github.com/dotnet/corefx
Community Standups – live.asp.net
Q&A
https://pixelastic.github.io/pokemonorbigdata/
© Copyright 2026 Paperzz