2. • What's wrong with current ASP.NET and why
change it?
• So, what's changed?
• OWIN, modularity, bye-bye sytem.web
• Changes that matter to developers
• New project structure, JSON configurations, Roslyn,
dependency management, compiling for multiple
platforms
• The "K" world
• MVC 6 features
• POCO controllers, DI
Agenda
3. Current ASP.NET stack
Windows Server
IIS
.NET Framework
ASP.NET
Web
Forms
MVC Web API
System.Web
HTTP
Modules
HTTP
Handlers
Request
Pipeline
Caching
Session
State
4. • Limited hosting possibilities (IIS only)
• Dependency on IIS environment (System.Web)
• Web evolves faster than .NET framework
• Requires full-blown .NET framework - resource
intensive and not web-friendly
• Hard to optimize for lightweight high-performance
apps
• Not completely cloud-optimized
Problems with ASP.NET architecture
5. Introducing ASP.NET 5 stack
OS
.NET CLR
ASP.NET
Web API MVC Web Pages
Host
IIS Self-hosted
.NET Core CLR
OWIN
6. • Totally modular
• NuGet is first-class citizen in ASP.NET 5
• Everything is a package
• Lightweight - you use minumum set of modules
• Faster startup, lower memory (>90%)
• Does not require .NET Framework installation -
runtime environment (CLR) can be deployed with
your application
Key improvements in ASP.NET 5
7. Key improvements in ASP.NET 5
• Cross platform - can be hosted anywhere:
• IIS, self-hosted, Linux, MAC...
• Web Forms are left aside for now
• Better developer experience
• No-compile debugging with Roslyn, MVC unified
programming model, basic DI out-of-the-box...
• Everything is open-source
• Architecture is OWIN based
8. Let's talk about OWIN
• Open Web INterfaces
• Public standard created by Microsoft
(http://owin.org/)
• Decouples application from server
• Enforces modularity of the server
• Stack of modules (middlewares) is processing the
request from application to server
• Microsoft implementation of OWIN is "Katana"
10. • Modularity - small and focused components
• Flexibility - gives control to use only needed
middlewares
• Performance - uses fewer computing resources
• Scalability - add new middlewares on demand
• Portability - host application anywhere
• ASP.NET pipeline on IIS
• ASP.NET pipeline without IIS (Kestrel web server)
• Self-hosted
• OwinHost.exe
Power of Katana
11. Katana implementation
• There are two important objects in Katana
implementation:
• Environment dictionary:
IDictionary<string, object>
• Application delegate:
Func<IDictionary<string, object>, Task>
...
owin.RequestBody
owin.RequestHeaders
owin.RequestQueryString
owin.RequestProtocol
...
12. • ASP.NET 5 is still in preview
• Comming with Visual Studio 2015,
currently available version is CTP 5
You can try it while it's hot!
14. • Dependencies - lists all the dependencies of your
application (NuGet, source files, etc.)
• Configuration - compilation settings (debug, release)
• Frameworks - target frameworks with their
dependencies
• Sources - what should be compiled
• Web root - server root of the app
• Shared files - files shared with dependent projects
• Commands - commands available to "K.cmd"
• Scripts - pre/post events to hook scripts to
• Metadata - general project information
Structure of the "project.json" file
15. • KRE - Runtime Environment
• Engine that runs your application (compilation system,
SDK tools, and the native CLR hosts)
• KVM - Version Manager
• Tool for updating and installing different versions of KRE
• KPM - Package Manager
• Tool to restore and install (NuGet) packages needed by
applications to run
• K
• Entry point to the runtime - starts the runtime with
commands
"K" command line tools
18. ASP.NET MVC 6
Web Pages + MVC + Web API =
ASP.NET MVC 6!
• Comes with package Microsoft.AspNet.Mvc
• One controller type for all
• Microsoft.AspNet.Mvc.Controller or
POCO controller
• Built-in DI support for environment services
• Can be replaced with your favourite (Ninject,
Autofac...)
- Prva verzija ASP.NET-a je izašla 2002. godine
- Ova promjena je velika kao prelazak s ASP na ASP.NET
http://developer.telerik.com/featured/microsofts-special-k-an-introduction-to-asp-net-vnext/
- Core CLR, k10, Cloud optimised CLR,... Cloud optimised znači da je framework svjestan clouda. Inače bi kod skaliranja trebali raditi razne trikove, npr. ako skaliramo web aplikaciju da se vrti na 3 VM-a, to neće proći glatko (load balancing, dijeljenje sessiona - treba nam node afinity, sticky session, dijeljenje cachea, itd.)
- To je podskup frameworka 4.6 - nema WinForms, WPF, WCF, Workflows... Distribuira se s aplikacijom kako svaki drugi paket.
- Sadrži CLR, JIT compiler, osnovne tipove, liste i sl. Sve drugo se dodaje kao NuGet.
- Request sa sobom nosi razne objekte zakačene (server, session, cache), ali ako nam ne trebaju nego npr. samo pisati JSON ili stream videa u socket onda je sve ostalo višak. Zato su i suporedbe Node.js sa ASP.NET-om besmislene - ne može se uspoređivati goli socket za svom infrastrukturom koju iza sebe nosi ASP.NET.
- Nema veze na registry, na GAC, na system32
- WebMatrix je IDE za WebPages