SlideShare a Scribd company logo
1 of 58
© Copyright SELA Software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com
Ido Flatow
Getting to Know ASP.NET 5 and MVC 6
Agenda
Introduction to ASP.NET 5
What’s new in ASP.NET 5
ASP.NET MVC 6
About Me
Senior Architect, Sela Group
Microsoft Regional Director, and an ASP.NET/IIS MVP
Co-author of courses and books
Focus on server, web, and cloud
Manager of the Israeli Web Developers User Group
History of ASP (18 years)
1996 - Active Server Pages (ASP)
2002 – ASP.NET
2008 – ASP.NET MVC
2010 – ASP.NET Web Pages
2012 – ASP.NET Web API, SignalR
2014 – ASP.NET vNext
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
Problems with ASP.NET architecture
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
Introducing ASP.NET 5 stack
OS
.NET CLR
ASP.NET
Web API MVC Web Pages
Host
IIS Self-hosted
.NET Core CLR
Middleware
.NET 2015: High-Level Overview
.NET Framework 4.6
.NET Core & App Models
Caution
At the time of this presentation, we are using
DNX-CLR-x86 1.0.0-beta4 (ASP.NET 5 beta 4)
As things are moving really fast in this new
world, it’s very likely that the things explained
here will slightly change
ASP.NET 5 – Agility
Faster Development Cycle
Features are shipped as packages
Framework ships as part of the application
More Control
Zero day security bugs patched by Microsoft
Same code runs in development and production
Developer opts into new versions, allowing breaking
changes
ASP.NET 5 - Fast
Runtime Performance
Faster startup times
Lower memory / higher density (> 90% reduction)
Modular, opt into just features needed
Use a raw socket, framework or both
Development productivity and low friction
Edit code and refresh browser
Flexibility of dynamic environment with the power of
.NET
Develop with Visual Studio, third party and cloud
editors
ASP.NET 5 – Cross Platform
Runtime
Windows, Mac, Linux
Editors
Visual Studio, Text, Cloud editors
OmniSharp – Sublime, Emacs, Vi, etc.
No editors (command line)
All Open Source with Contributions
ASP.NET 5 Features
New flexible and cross-platform runtime
New modular HTTP request pipeline
Robust environment configuration
Unified programming model for MVC API
See changes without re-building the project
Side-by-side versioning of the .NET Framework
Built in Dependency Injection
Ability to self-host or host on IIS
Open source in GitHub
File  New Project  Web
Web App
Class Lib?
Console App?
Select a Template
Startup.cs Configuration
Let's talk about OWIN
Open Web Interface for .NET
Community project (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"
OWIN Implementation
Host
Middleware
Server
Application
Middleware
Middleware
Request Response
Startup, bootstrapping,
process management
Manages sockets,
delegates to middlewares
Pass-through
components stack
Your code
ASP.NET 5 Middlewares
Improved HTTP performance
New HTTP request pipeline that is lean and fast
The new pipeline also supports OWIN
You choose what to use in your application
By registering middlewares
public void Configure(IApplicationBuilder app,
IHostingEnvironment env, ILoggerFactory loggerfactory)
{
app.UseErrorHandler("/Home/Error");
app.UseStaticFiles();
app.UseIdentity();
app.UseMvc(routes => ...)
}
Custom Middleware
Create middleware class
app.UseMiddleware<AppHeaderMiddleware>();
// Register before app.UseMvc(...);
public class AppHeaderMiddleware {
private readonly RequestDelegate next;
public AppHeaderMiddleware(RequestDelegate next) {
this.next = next;
}
public async Task Invoke(HttpContext context) {
context.Response.Headers.Append(
"X-Application", "ASP.NET 5 Sample App");
await this.next.Invoke(context);
}
}
Register in Startup.cs (IApplicationBuilder)
Project.json
Package Management
ASP.NET 5 introduces a new, lightweight way to
manage dependencies in your projects
No more assembly references
Instead referencing NuGet packages
project.json file
Structure of the "project.json" file
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 “dnx”
Scripts - pre/post events to hook scripts to
Metadata - general project information
Right-click  (Project) Properties
Compilation Process
Debugging without Roslyn
Change the
code
C#
Compiler
invoked
Load code
in memory
Execute
the dll
dll loaded
in memory
from File
system
Emits the
dll in file
system
Debugging with Roslyn
Change the
code
Load code
in memory
Code is
Executed in
memory
Roslyn
compiles
code in
memory
Time reduced from 7-8 second to 1-2 second
"K“ / ”DNX” Command Line Tools
KRE / DNX- Runtime Environment
Engine that runs your application (compilation system,
SDK tools, and the native CLR hosts)
KVM / DNVM - Version Manager
Tool for updating and installing different versions of
KRE/DNX
KPM / DNU- Package Manager
Tool to restore and install (NuGet) packages needed by
applications to run
K / DNX
Entry point to the runtime - starts the runtime with
commands
OpenSource
Runtime Loader
IIS: WebEngine4
Exe: OS
DNX
Operating SystemWindows
Windows, OSX,
Linux
Libraries
Loose, GAC,
Nuget
NuGet, NPM,
Bower
App FrameworksFCL, GAC, NuGet NuGet
Web ServerIIS
IIS, HTTP.SYS,
Kestrel
Application HostSystem.Web DNX
Platform Libraries.NET BCL & FCL
.NET BCL & FCL
.NET on Nuget
Runtime.NET CLR
.NET CLR
.NET Core CLR
Application
MSBuild/CodeDom
-> csc.exe
DNX (Roslyn)
Present vs. Future
© Copyright SELA Software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com
MVC 6
ASP.NET <5 Frameworks
ASP.NET 5 with MVC 6
MVC + Web API + Web Pages =
ASP.NET MVC 6!
ASP.NET MVC 6
No more duplication - one set of concepts
Used for creating both UI and API
Smooth transition from Web Pages to MVC
Based on the new ASP.NET 5 pipeline
Built DI first
Runs on IIS or self-host
Getting Started with MVC 6
Startup.cs
Project.json
app.UseMvc(routes =>
{
routes.MapRoute("default", "{controller}/{action}/{id?}",
new { controller = "Home", action = "Index" });
});
app.UseServices(services => { services.addMvc(); })
"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-*",
// Add this:
"Microsoft.AspNet.Mvc": "6.0.0-*"
}
Routing Template Improvements
Inline constraints
Product/{ProductId:long}
Product/{ProductName:alpha}
Product/{ProductName:minlength(10)}
Product/{productId:regex(^d{4}$)}
Optional parameters
Product/{productId:long?}
Default values
Product/{productId:long=1}
Available with MapRoute() and [Route()]
https://github.com/aspnet/Routing/tree/dev/src/
Microsoft.AspNet.Routing
Where is the Web API
Configuration?
Route configuration -> attribute-based routing
Message handlers -> middleware pipeline
Filters and Formatters -> startup.cs
app.UseServices(services => {
services.Configure<MvcOptions>(options =>
{
options.AddXmlDataContractSerializerFormatter();
options.Filters.Add(new ValidatorFilterAttribute());
});
}
Controllers – Two Birds, One Stone
API – similar, but different
UI – same as with MVC 5
[Route("api/[controller]")]
public class ProductsController : Controller
{
[HttpGet("{id:int}")]
public Product GetProduct(int id)
{
return new Product() { ID = id };
}
}
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
}
Actions – API with IActionResult
[HttpGet("{id:int}", Name = "GetByIdRoute")]
public IActionResult GetById (int id)
{
var item = _items.FirstOrDefault(x => x.Id == id);
if (item == null) { return HttpNotFound(); }
return new ObjectResult(item);
}
[HttpPost]
public IActionResult CreateTodoItem([FromBody] TodoItem item)
{
_items.Add(item);
return CreatedAtRoute(
"GetByIdRoute", new { id = item.Id }, item);
}
IActionResult for UI and API
https://github.com/aspnet/Mvc/tree/dev/src/
Microsoft.AspNet.Mvc.Core/ActionResults
UI API
PartialViewResult BadRequestResult
RedirectResult ContentResult
ViewResult CreatedAtRouteResult
JsonResult HttpStatusCodeResult
JsonResult
ObjectResult
ChallengeResult
HttpNotFoundResult
FileContentResult
Content Negotiation
MVC still respects Accept headers
The XML formatter was removed from the MVC 6
pipeline
You can manually add it to the Formatters collection
Forcing a content-type:
Return a JsonResult
Use the [Produces("application/json")] attribute
Additional changes:
Actions returning string result in text/plain responses
Returning null/void – response will be HTTP 204 (no
content)
Last Controller Goodie - DI
Dependency Injection and MVC
ASP.NET 5 is DI-friendly
Basic DI container available throughout the stack
BYOC is also supported (already implemented for
Autofac, Ninject, StructureMap, Unity, and Windsor)
Out-of-the-box container supports
Singleton / Instance – single instance
Transient – new instance each time
Scoped – new instance per request
https://github.com/aspnet/DependencyInjection/tree
/dev/src
Last Controller Goodie - DI
public class ProductsController : Controller
{
private readonly IProductsRepository _repository;
public ProductsController(IProductsRepository repository)
{
this._repository = repository;
}
public IActionResult Index()
{
var products = _repository.GetAllProducts();
return View(products);
}
}
app.UseServices(services =>
{
services.AddTransient<IProductsRepository, DefaultProductsRepository>();
});
Look Ma No Controller
Use the Controller suffix
Inject HTTP request, principal, and view data with:
Convention-based property injection
Constructor injection
public class SimpleController
{
[Activate]
public ActionContext ActionContext { get; set; }
[Activate]
public ViewDataDictionary ViewData { get; set; }
[Activate]
public IUrlHelper Url { get; set; }
public string Get()
{
return "Hello world";
}
}
Enough with Controllers,
What About MVC Views?
Oh, right!
Child Actions in MVC <6
Rendering partial views with controller logic
and model
Do not confuse with Html.Partial
@Html.Action("GetProductDetails", "Products", new { id = 1})
[ChildActionOnly]
public ActionResult GetProductDetails(int id)
{
var product = _repository.GetProduct(id);
return PartialView("ProductDetails", product);
}
Child Actions in MVC 6
So what’s the problem?
Part of a controller, but invoked from a view
Controller flow must distinguish between HTTP calls and
view calls
Pattern lacks an asynchronous invocation
Solution?
Replace child actions with View Components
Same partial views, but declared in a separate class
Think of it as a “mini-controller”
Supports the same DI and POCO features as a controller
Implement actions as synchronous or asynchronous
View Components in MVC 6
//[ViewComponent(Name = "ProductDetails")]
public class ProductDetailsViewComponent : ViewComponent
{
private readonly IProductsRepository _repository;
public ProductDetailsViewComponent(IProductsRepository repository)
{
_repository = repository;
}
public IViewComponentResult Invoke(int id)
{
var product = _repository.GetProduct(id);
return View(product);
}
@Component.Invoke("ProductDetails", 1)
// Or as async, if InvokeAsync is implemented in the view component
@await Component.InvokeAsync("ProductDetails", 1)
And the Partial View?
Create a default.cshtml file
(content structured similar as with MVC <6)
Place file in:
Controller-specific:
Views/{controller}/Components/ProductDetails/Default.cshtml
Shared:
Views/Shared/Components/ProductDetails/Default.cshtml
Customizing view name is supported
Create a file other than Default.cshtml
Return View(viewName, model)
Injecting Services to Views
Preferable than using static classes/methods
Use interfaces instead of concrete types
Register in IoC using different lifecycles
public class CatalogService : ICatalogService
{
public async Task<int> GetTotalProducts() {...} // From ICatalogService
}
@inject MyApp.Services.ICatalogService Catalog
<html>
<body>
<h3>Number of products in the catalog</h3>
@await Catalog.GetTotalProducts()
</body>
</html>
services.AddTransient<ICatalogService, CatalogService>();
Last, but not Least, Tag Helpers
Do this:
Ah? What’s that?
Instead of doing this:
<form asp-anti-forgery="true" asp-action="UpdateProduct">
…
</form>
using (Html.BeginForm("UpdateProduct", "Products", FormMethod.Post))
{
@Html.AntiForgeryToken()
…
}
It’s the return of Web Controls, NOOOOOO!!!
Tag Helpers are not Evil
Tag Helpers generate markup only within their
enclosing tag
Less Razor/HTML mess in the .cshtml file
JavaScript directive style approach
Use C# to better construct the markup
Add/remove parts from the inner content
Generate complex HTML (recursive, nested, …)
Cache the output
Existing Tag Helpers
HTML elements
<a>, <form>, <input>, <label>, <link>, <script>,
<select>, <textarea>
Logical
<cache>
Placeholders
ValidationSummary (<div>), ValidationMessage (<span>)
You can create your own Tag Helpers
Check out the source for reference
https://github.com/aspnet/Mvc/tree/dev/src/Micros
oft.AspNet.Mvc.TagHelpers
Key Improvements in ASP.NET 5
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
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
Getting Started with ASP.NET 5
Ships with Visual Studio 2015
Walkthroughs and samples at http://asp.net/vnext
Documentation at http://docs.asp.net/en/latest
Get the code from http://github.com/aspnet
Read blogs at http://blogs.msdn.com/b/webdev
Try out a nightly build from MyGet
https://www.myget.org/F/aspnetvnext
My Info
idof@sela.co.il
@idoFlatow
http://bit.ly/flatowblog

More Related Content

What's hot

Next.js vs React | what to choose for frontend development_
Next.js vs React | what to choose for frontend development_Next.js vs React | what to choose for frontend development_
Next.js vs React | what to choose for frontend development_ForceBolt
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...Edureka!
 
Clean backends with NestJs
Clean backends with NestJsClean backends with NestJs
Clean backends with NestJsAymene Bennour
 
Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBhargav Anadkat
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC PresentationVolkan Uzun
 
ASP.NET MVC.
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.Ni
 
Introduction to ASP.NET Core
Introduction to ASP.NET CoreIntroduction to ASP.NET Core
Introduction to ASP.NET CoreAvanade Nederland
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentationivpol
 
Building A CICD Pipeline for Deploying to Containers
Building A CICD Pipeline for Deploying to ContainersBuilding A CICD Pipeline for Deploying to Containers
Building A CICD Pipeline for Deploying to ContainersAmazon Web Services
 

What's hot (20)

Next.js vs React | what to choose for frontend development_
Next.js vs React | what to choose for frontend development_Next.js vs React | what to choose for frontend development_
Next.js vs React | what to choose for frontend development_
 
React Native
React NativeReact Native
React Native
 
Java Spring Framework
Java Spring FrameworkJava Spring Framework
Java Spring Framework
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
 
Clean backends with NestJs
Clean backends with NestJsClean backends with NestJs
Clean backends with NestJs
 
Angular
AngularAngular
Angular
 
Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPM
 
Lab#5 style and selector
Lab#5 style and selectorLab#5 style and selector
Lab#5 style and selector
 
Getting started with entity framework
Getting started with entity framework Getting started with entity framework
Getting started with entity framework
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
Introduction to Angularjs
Introduction to AngularjsIntroduction to Angularjs
Introduction to Angularjs
 
Web api
Web apiWeb api
Web api
 
ASP.NET MVC.
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.
 
VueJS: The Simple Revolution
VueJS: The Simple RevolutionVueJS: The Simple Revolution
VueJS: The Simple Revolution
 
Introduction to ASP.NET Core
Introduction to ASP.NET CoreIntroduction to ASP.NET Core
Introduction to ASP.NET Core
 
NestJS
NestJSNestJS
NestJS
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
Spring Data Jpa
Spring Data JpaSpring Data Jpa
Spring Data Jpa
 
Express JS
Express JSExpress JS
Express JS
 
Building A CICD Pipeline for Deploying to Containers
Building A CICD Pipeline for Deploying to ContainersBuilding A CICD Pipeline for Deploying to Containers
Building A CICD Pipeline for Deploying to Containers
 

Viewers also liked

Dotnet Basics Presentation
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics PresentationSudhakar Sharma
 
ASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP FundamentalsASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP FundamentalsIdo Flatow
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2Ido Flatow
 
Asp.net mvc 5 course module 1 overview
Asp.net mvc 5 course   module 1 overviewAsp.net mvc 5 course   module 1 overview
Asp.net mvc 5 course module 1 overviewSergey Seletsky
 
Getting Started with ASP.NET MVC
Getting Started with ASP.NET MVCGetting Started with ASP.NET MVC
Getting Started with ASP.NET MVCshobokshi
 
ASP.NET MVC Best Practices malisa ncube
ASP.NET MVC Best Practices   malisa ncubeASP.NET MVC Best Practices   malisa ncube
ASP.NET MVC Best Practices malisa ncubeMalisa Ncube
 
Async patterns in javascript
Async patterns in javascriptAsync patterns in javascript
Async patterns in javascriptRan Wahle
 
Responsive ui
Responsive uiResponsive ui
Responsive uiRan Wahle
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Thomas Robbins
 
What's New in WCF 4.5
What's New in WCF 4.5What's New in WCF 4.5
What's New in WCF 4.5Ido Flatow
 
The Essentials of Building Cloud-Based Web Apps with Azure
The Essentials of Building Cloud-Based Web Apps with AzureThe Essentials of Building Cloud-Based Web Apps with Azure
The Essentials of Building Cloud-Based Web Apps with AzureIdo Flatow
 
Powershell For Developers
Powershell For DevelopersPowershell For Developers
Powershell For DevelopersIdo Flatow
 
Debugging the Web with Fiddler
Debugging the Web with FiddlerDebugging the Web with Fiddler
Debugging the Web with FiddlerIdo Flatow
 
Getting Started with the TypeScript Language
Getting Started with the TypeScript LanguageGetting Started with the TypeScript Language
Getting Started with the TypeScript LanguageGil Fink
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0Ido Flatow
 

Viewers also liked (20)

MVC 6 Introduction
MVC 6 IntroductionMVC 6 Introduction
MVC 6 Introduction
 
Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
 
Dotnet Basics Presentation
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics Presentation
 
MVC - Introduction
MVC - IntroductionMVC - Introduction
MVC - Introduction
 
ASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP FundamentalsASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP Fundamentals
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2
 
Asp.net mvc 5 course module 1 overview
Asp.net mvc 5 course   module 1 overviewAsp.net mvc 5 course   module 1 overview
Asp.net mvc 5 course module 1 overview
 
Getting Started with ASP.NET MVC
Getting Started with ASP.NET MVCGetting Started with ASP.NET MVC
Getting Started with ASP.NET MVC
 
ASP.NET MVC Best Practices malisa ncube
ASP.NET MVC Best Practices   malisa ncubeASP.NET MVC Best Practices   malisa ncube
ASP.NET MVC Best Practices malisa ncube
 
Webcomponents v2
Webcomponents v2Webcomponents v2
Webcomponents v2
 
Async patterns in javascript
Async patterns in javascriptAsync patterns in javascript
Async patterns in javascript
 
Responsive ui
Responsive uiResponsive ui
Responsive ui
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
 
What's New in WCF 4.5
What's New in WCF 4.5What's New in WCF 4.5
What's New in WCF 4.5
 
EF Core (RC2)
EF Core (RC2)EF Core (RC2)
EF Core (RC2)
 
The Essentials of Building Cloud-Based Web Apps with Azure
The Essentials of Building Cloud-Based Web Apps with AzureThe Essentials of Building Cloud-Based Web Apps with Azure
The Essentials of Building Cloud-Based Web Apps with Azure
 
Powershell For Developers
Powershell For DevelopersPowershell For Developers
Powershell For Developers
 
Debugging the Web with Fiddler
Debugging the Web with FiddlerDebugging the Web with Fiddler
Debugging the Web with Fiddler
 
Getting Started with the TypeScript Language
Getting Started with the TypeScript LanguageGetting Started with the TypeScript Language
Getting Started with the TypeScript Language
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0
 

Similar to Getting to Know ASP.NET 5 and MVC 6

The next step from Microsoft - Vnext (Srdjan Poznic)
The next step from Microsoft - Vnext (Srdjan Poznic)The next step from Microsoft - Vnext (Srdjan Poznic)
The next step from Microsoft - Vnext (Srdjan Poznic)Geekstone
 
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)Arrow Consulting & Design
 
Scalable Web Architectures and Infrastructure
Scalable Web Architectures and InfrastructureScalable Web Architectures and Infrastructure
Scalable Web Architectures and Infrastructuregeorge.james
 
Windows Azure & How to Deploy Wordress
Windows Azure & How to Deploy WordressWindows Azure & How to Deploy Wordress
Windows Azure & How to Deploy WordressGeorge Kanellopoulos
 
Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015Bluegrass Digital
 
Vijay Oscon
Vijay OsconVijay Oscon
Vijay Osconvijayrvr
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET PresentationRasel Khan
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technologyMinal Maniar
 
Play Framework: The Basics
Play Framework: The BasicsPlay Framework: The Basics
Play Framework: The BasicsPhilip Langer
 
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...Quek Lilian
 
A Microsoft primer for PHP devs
A Microsoft primer for PHP devsA Microsoft primer for PHP devs
A Microsoft primer for PHP devsguest0a62e8
 
Asp dot net final (1)
Asp dot net   final (1)Asp dot net   final (1)
Asp dot net final (1)amelinaahmeti
 
Asp dot net final (1)
Asp dot net   final (1)Asp dot net   final (1)
Asp dot net final (1)amelinaahmeti
 
Windows Loves Drupal
Windows Loves DrupalWindows Loves Drupal
Windows Loves DrupalAcquia
 
RichardChauvetShortResume2015
RichardChauvetShortResume2015RichardChauvetShortResume2015
RichardChauvetShortResume2015Richard Chauvet
 

Similar to Getting to Know ASP.NET 5 and MVC 6 (20)

The next step from Microsoft - Vnext (Srdjan Poznic)
The next step from Microsoft - Vnext (Srdjan Poznic)The next step from Microsoft - Vnext (Srdjan Poznic)
The next step from Microsoft - Vnext (Srdjan Poznic)
 
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)
 
Asp.net
Asp.netAsp.net
Asp.net
 
Scalable Web Architectures and Infrastructure
Scalable Web Architectures and InfrastructureScalable Web Architectures and Infrastructure
Scalable Web Architectures and Infrastructure
 
Windows Azure & How to Deploy Wordress
Windows Azure & How to Deploy WordressWindows Azure & How to Deploy Wordress
Windows Azure & How to Deploy Wordress
 
Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015
 
Vijay Oscon
Vijay OsconVijay Oscon
Vijay Oscon
 
ASP.NET vNext
ASP.NET vNextASP.NET vNext
ASP.NET vNext
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technology
 
Play Framework: The Basics
Play Framework: The BasicsPlay Framework: The Basics
Play Framework: The Basics
 
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
 
Asp dot net final (2)
Asp dot net   final (2)Asp dot net   final (2)
Asp dot net final (2)
 
A Microsoft primer for PHP devs
A Microsoft primer for PHP devsA Microsoft primer for PHP devs
A Microsoft primer for PHP devs
 
Asp dot net final (1)
Asp dot net   final (1)Asp dot net   final (1)
Asp dot net final (1)
 
Asp dot net final (1)
Asp dot net   final (1)Asp dot net   final (1)
Asp dot net final (1)
 
Asp dot net final (1)
Asp dot net   final (1)Asp dot net   final (1)
Asp dot net final (1)
 
Asp dot net long
Asp dot net longAsp dot net long
Asp dot net long
 
Windows Loves Drupal
Windows Loves DrupalWindows Loves Drupal
Windows Loves Drupal
 
RichardChauvetShortResume2015
RichardChauvetShortResume2015RichardChauvetShortResume2015
RichardChauvetShortResume2015
 

More from Ido Flatow

Google Cloud IoT Core
Google Cloud IoT CoreGoogle Cloud IoT Core
Google Cloud IoT CoreIdo Flatow
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2Ido Flatow
 
Production Debugging War Stories
Production Debugging War StoriesProduction Debugging War Stories
Production Debugging War StoriesIdo Flatow
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2Ido Flatow
 
Production debugging web applications
Production debugging web applicationsProduction debugging web applications
Production debugging web applicationsIdo Flatow
 
From VMs to Containers: Introducing Docker Containers for Linux and Windows S...
From VMs to Containers: Introducing Docker Containers for Linux and Windows S...From VMs to Containers: Introducing Docker Containers for Linux and Windows S...
From VMs to Containers: Introducing Docker Containers for Linux and Windows S...Ido Flatow
 
Building IoT and Big Data Solutions on Azure
Building IoT and Big Data Solutions on AzureBuilding IoT and Big Data Solutions on Azure
Building IoT and Big Data Solutions on AzureIdo Flatow
 
Migrating Customers to Microsoft Azure: Lessons Learned From the Field
Migrating Customers to Microsoft Azure: Lessons Learned From the FieldMigrating Customers to Microsoft Azure: Lessons Learned From the Field
Migrating Customers to Microsoft Azure: Lessons Learned From the FieldIdo Flatow
 
Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015Ido Flatow
 
Introducing HTTP/2
Introducing HTTP/2Introducing HTTP/2
Introducing HTTP/2Ido Flatow
 
IaaS vs. PaaS: Windows Azure Compute Solutions
IaaS vs. PaaS: Windows Azure Compute SolutionsIaaS vs. PaaS: Windows Azure Compute Solutions
IaaS vs. PaaS: Windows Azure Compute SolutionsIdo Flatow
 
Advanced WCF Workshop
Advanced WCF WorkshopAdvanced WCF Workshop
Advanced WCF WorkshopIdo Flatow
 
IIS for Developers
IIS for DevelopersIIS for Developers
IIS for DevelopersIdo Flatow
 
Debugging with Fiddler
Debugging with FiddlerDebugging with Fiddler
Debugging with FiddlerIdo Flatow
 
Caching in Windows Azure
Caching in Windows AzureCaching in Windows Azure
Caching in Windows AzureIdo Flatow
 
Automating Windows Azure
Automating Windows AzureAutomating Windows Azure
Automating Windows AzureIdo Flatow
 

More from Ido Flatow (16)

Google Cloud IoT Core
Google Cloud IoT CoreGoogle Cloud IoT Core
Google Cloud IoT Core
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2
 
Production Debugging War Stories
Production Debugging War StoriesProduction Debugging War Stories
Production Debugging War Stories
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2
 
Production debugging web applications
Production debugging web applicationsProduction debugging web applications
Production debugging web applications
 
From VMs to Containers: Introducing Docker Containers for Linux and Windows S...
From VMs to Containers: Introducing Docker Containers for Linux and Windows S...From VMs to Containers: Introducing Docker Containers for Linux and Windows S...
From VMs to Containers: Introducing Docker Containers for Linux and Windows S...
 
Building IoT and Big Data Solutions on Azure
Building IoT and Big Data Solutions on AzureBuilding IoT and Big Data Solutions on Azure
Building IoT and Big Data Solutions on Azure
 
Migrating Customers to Microsoft Azure: Lessons Learned From the Field
Migrating Customers to Microsoft Azure: Lessons Learned From the FieldMigrating Customers to Microsoft Azure: Lessons Learned From the Field
Migrating Customers to Microsoft Azure: Lessons Learned From the Field
 
Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015
 
Introducing HTTP/2
Introducing HTTP/2Introducing HTTP/2
Introducing HTTP/2
 
IaaS vs. PaaS: Windows Azure Compute Solutions
IaaS vs. PaaS: Windows Azure Compute SolutionsIaaS vs. PaaS: Windows Azure Compute Solutions
IaaS vs. PaaS: Windows Azure Compute Solutions
 
Advanced WCF Workshop
Advanced WCF WorkshopAdvanced WCF Workshop
Advanced WCF Workshop
 
IIS for Developers
IIS for DevelopersIIS for Developers
IIS for Developers
 
Debugging with Fiddler
Debugging with FiddlerDebugging with Fiddler
Debugging with Fiddler
 
Caching in Windows Azure
Caching in Windows AzureCaching in Windows Azure
Caching in Windows Azure
 
Automating Windows Azure
Automating Windows AzureAutomating Windows Azure
Automating Windows Azure
 

Recently uploaded

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 

Recently uploaded (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 

Getting to Know ASP.NET 5 and MVC 6

  • 1. © Copyright SELA Software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com Ido Flatow Getting to Know ASP.NET 5 and MVC 6
  • 2. Agenda Introduction to ASP.NET 5 What’s new in ASP.NET 5 ASP.NET MVC 6
  • 3. About Me Senior Architect, Sela Group Microsoft Regional Director, and an ASP.NET/IIS MVP Co-author of courses and books Focus on server, web, and cloud Manager of the Israeli Web Developers User Group
  • 4. History of ASP (18 years) 1996 - Active Server Pages (ASP) 2002 – ASP.NET 2008 – ASP.NET MVC 2010 – ASP.NET Web Pages 2012 – ASP.NET Web API, SignalR 2014 – ASP.NET vNext
  • 5. 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
  • 6. Problems with ASP.NET architecture 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
  • 7. Introducing ASP.NET 5 stack OS .NET CLR ASP.NET Web API MVC Web Pages Host IIS Self-hosted .NET Core CLR Middleware
  • 10. .NET Core & App Models
  • 11. Caution At the time of this presentation, we are using DNX-CLR-x86 1.0.0-beta4 (ASP.NET 5 beta 4) As things are moving really fast in this new world, it’s very likely that the things explained here will slightly change
  • 12. ASP.NET 5 – Agility Faster Development Cycle Features are shipped as packages Framework ships as part of the application More Control Zero day security bugs patched by Microsoft Same code runs in development and production Developer opts into new versions, allowing breaking changes
  • 13. ASP.NET 5 - Fast Runtime Performance Faster startup times Lower memory / higher density (> 90% reduction) Modular, opt into just features needed Use a raw socket, framework or both Development productivity and low friction Edit code and refresh browser Flexibility of dynamic environment with the power of .NET Develop with Visual Studio, third party and cloud editors
  • 14. ASP.NET 5 – Cross Platform Runtime Windows, Mac, Linux Editors Visual Studio, Text, Cloud editors OmniSharp – Sublime, Emacs, Vi, etc. No editors (command line) All Open Source with Contributions
  • 15. ASP.NET 5 Features New flexible and cross-platform runtime New modular HTTP request pipeline Robust environment configuration Unified programming model for MVC API See changes without re-building the project Side-by-side versioning of the .NET Framework Built in Dependency Injection Ability to self-host or host on IIS Open source in GitHub
  • 16. File  New Project  Web Web App Class Lib? Console App?
  • 19. Let's talk about OWIN Open Web Interface for .NET Community project (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"
  • 20. OWIN Implementation Host Middleware Server Application Middleware Middleware Request Response Startup, bootstrapping, process management Manages sockets, delegates to middlewares Pass-through components stack Your code
  • 21. ASP.NET 5 Middlewares Improved HTTP performance New HTTP request pipeline that is lean and fast The new pipeline also supports OWIN You choose what to use in your application By registering middlewares public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerfactory) { app.UseErrorHandler("/Home/Error"); app.UseStaticFiles(); app.UseIdentity(); app.UseMvc(routes => ...) }
  • 22. Custom Middleware Create middleware class app.UseMiddleware<AppHeaderMiddleware>(); // Register before app.UseMvc(...); public class AppHeaderMiddleware { private readonly RequestDelegate next; public AppHeaderMiddleware(RequestDelegate next) { this.next = next; } public async Task Invoke(HttpContext context) { context.Response.Headers.Append( "X-Application", "ASP.NET 5 Sample App"); await this.next.Invoke(context); } } Register in Startup.cs (IApplicationBuilder)
  • 24. Package Management ASP.NET 5 introduces a new, lightweight way to manage dependencies in your projects No more assembly references Instead referencing NuGet packages project.json file
  • 25. Structure of the "project.json" file 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 “dnx” Scripts - pre/post events to hook scripts to Metadata - general project information
  • 28. Debugging without Roslyn Change the code C# Compiler invoked Load code in memory Execute the dll dll loaded in memory from File system Emits the dll in file system
  • 29. Debugging with Roslyn Change the code Load code in memory Code is Executed in memory Roslyn compiles code in memory Time reduced from 7-8 second to 1-2 second
  • 30. "K“ / ”DNX” Command Line Tools KRE / DNX- Runtime Environment Engine that runs your application (compilation system, SDK tools, and the native CLR hosts) KVM / DNVM - Version Manager Tool for updating and installing different versions of KRE/DNX KPM / DNU- Package Manager Tool to restore and install (NuGet) packages needed by applications to run K / DNX Entry point to the runtime - starts the runtime with commands
  • 31. OpenSource Runtime Loader IIS: WebEngine4 Exe: OS DNX Operating SystemWindows Windows, OSX, Linux Libraries Loose, GAC, Nuget NuGet, NPM, Bower App FrameworksFCL, GAC, NuGet NuGet Web ServerIIS IIS, HTTP.SYS, Kestrel Application HostSystem.Web DNX Platform Libraries.NET BCL & FCL .NET BCL & FCL .NET on Nuget Runtime.NET CLR .NET CLR .NET Core CLR Application MSBuild/CodeDom -> csc.exe DNX (Roslyn) Present vs. Future
  • 32. © Copyright SELA Software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com MVC 6
  • 34. ASP.NET 5 with MVC 6
  • 35. MVC + Web API + Web Pages = ASP.NET MVC 6!
  • 36. ASP.NET MVC 6 No more duplication - one set of concepts Used for creating both UI and API Smooth transition from Web Pages to MVC Based on the new ASP.NET 5 pipeline Built DI first Runs on IIS or self-host
  • 37. Getting Started with MVC 6 Startup.cs Project.json app.UseMvc(routes => { routes.MapRoute("default", "{controller}/{action}/{id?}", new { controller = "Home", action = "Index" }); }); app.UseServices(services => { services.addMvc(); }) "dependencies": { "Microsoft.AspNet.Server.IIS": "1.0.0-*", // Add this: "Microsoft.AspNet.Mvc": "6.0.0-*" }
  • 38. Routing Template Improvements Inline constraints Product/{ProductId:long} Product/{ProductName:alpha} Product/{ProductName:minlength(10)} Product/{productId:regex(^d{4}$)} Optional parameters Product/{productId:long?} Default values Product/{productId:long=1} Available with MapRoute() and [Route()] https://github.com/aspnet/Routing/tree/dev/src/ Microsoft.AspNet.Routing
  • 39. Where is the Web API Configuration? Route configuration -> attribute-based routing Message handlers -> middleware pipeline Filters and Formatters -> startup.cs app.UseServices(services => { services.Configure<MvcOptions>(options => { options.AddXmlDataContractSerializerFormatter(); options.Filters.Add(new ValidatorFilterAttribute()); }); }
  • 40. Controllers – Two Birds, One Stone API – similar, but different UI – same as with MVC 5 [Route("api/[controller]")] public class ProductsController : Controller { [HttpGet("{id:int}")] public Product GetProduct(int id) { return new Product() { ID = id }; } } public class HomeController : Controller { public IActionResult Index() { return View(); } }
  • 41. Actions – API with IActionResult [HttpGet("{id:int}", Name = "GetByIdRoute")] public IActionResult GetById (int id) { var item = _items.FirstOrDefault(x => x.Id == id); if (item == null) { return HttpNotFound(); } return new ObjectResult(item); } [HttpPost] public IActionResult CreateTodoItem([FromBody] TodoItem item) { _items.Add(item); return CreatedAtRoute( "GetByIdRoute", new { id = item.Id }, item); }
  • 42. IActionResult for UI and API https://github.com/aspnet/Mvc/tree/dev/src/ Microsoft.AspNet.Mvc.Core/ActionResults UI API PartialViewResult BadRequestResult RedirectResult ContentResult ViewResult CreatedAtRouteResult JsonResult HttpStatusCodeResult JsonResult ObjectResult ChallengeResult HttpNotFoundResult FileContentResult
  • 43. Content Negotiation MVC still respects Accept headers The XML formatter was removed from the MVC 6 pipeline You can manually add it to the Formatters collection Forcing a content-type: Return a JsonResult Use the [Produces("application/json")] attribute Additional changes: Actions returning string result in text/plain responses Returning null/void – response will be HTTP 204 (no content)
  • 44. Last Controller Goodie - DI Dependency Injection and MVC ASP.NET 5 is DI-friendly Basic DI container available throughout the stack BYOC is also supported (already implemented for Autofac, Ninject, StructureMap, Unity, and Windsor) Out-of-the-box container supports Singleton / Instance – single instance Transient – new instance each time Scoped – new instance per request https://github.com/aspnet/DependencyInjection/tree /dev/src
  • 45. Last Controller Goodie - DI public class ProductsController : Controller { private readonly IProductsRepository _repository; public ProductsController(IProductsRepository repository) { this._repository = repository; } public IActionResult Index() { var products = _repository.GetAllProducts(); return View(products); } } app.UseServices(services => { services.AddTransient<IProductsRepository, DefaultProductsRepository>(); });
  • 46. Look Ma No Controller Use the Controller suffix Inject HTTP request, principal, and view data with: Convention-based property injection Constructor injection public class SimpleController { [Activate] public ActionContext ActionContext { get; set; } [Activate] public ViewDataDictionary ViewData { get; set; } [Activate] public IUrlHelper Url { get; set; } public string Get() { return "Hello world"; } }
  • 47. Enough with Controllers, What About MVC Views? Oh, right!
  • 48. Child Actions in MVC <6 Rendering partial views with controller logic and model Do not confuse with Html.Partial @Html.Action("GetProductDetails", "Products", new { id = 1}) [ChildActionOnly] public ActionResult GetProductDetails(int id) { var product = _repository.GetProduct(id); return PartialView("ProductDetails", product); }
  • 49. Child Actions in MVC 6 So what’s the problem? Part of a controller, but invoked from a view Controller flow must distinguish between HTTP calls and view calls Pattern lacks an asynchronous invocation Solution? Replace child actions with View Components Same partial views, but declared in a separate class Think of it as a “mini-controller” Supports the same DI and POCO features as a controller Implement actions as synchronous or asynchronous
  • 50. View Components in MVC 6 //[ViewComponent(Name = "ProductDetails")] public class ProductDetailsViewComponent : ViewComponent { private readonly IProductsRepository _repository; public ProductDetailsViewComponent(IProductsRepository repository) { _repository = repository; } public IViewComponentResult Invoke(int id) { var product = _repository.GetProduct(id); return View(product); } @Component.Invoke("ProductDetails", 1) // Or as async, if InvokeAsync is implemented in the view component @await Component.InvokeAsync("ProductDetails", 1)
  • 51. And the Partial View? Create a default.cshtml file (content structured similar as with MVC <6) Place file in: Controller-specific: Views/{controller}/Components/ProductDetails/Default.cshtml Shared: Views/Shared/Components/ProductDetails/Default.cshtml Customizing view name is supported Create a file other than Default.cshtml Return View(viewName, model)
  • 52. Injecting Services to Views Preferable than using static classes/methods Use interfaces instead of concrete types Register in IoC using different lifecycles public class CatalogService : ICatalogService { public async Task<int> GetTotalProducts() {...} // From ICatalogService } @inject MyApp.Services.ICatalogService Catalog <html> <body> <h3>Number of products in the catalog</h3> @await Catalog.GetTotalProducts() </body> </html> services.AddTransient<ICatalogService, CatalogService>();
  • 53. Last, but not Least, Tag Helpers Do this: Ah? What’s that? Instead of doing this: <form asp-anti-forgery="true" asp-action="UpdateProduct"> … </form> using (Html.BeginForm("UpdateProduct", "Products", FormMethod.Post)) { @Html.AntiForgeryToken() … } It’s the return of Web Controls, NOOOOOO!!!
  • 54. Tag Helpers are not Evil Tag Helpers generate markup only within their enclosing tag Less Razor/HTML mess in the .cshtml file JavaScript directive style approach Use C# to better construct the markup Add/remove parts from the inner content Generate complex HTML (recursive, nested, …) Cache the output
  • 55. Existing Tag Helpers HTML elements <a>, <form>, <input>, <label>, <link>, <script>, <select>, <textarea> Logical <cache> Placeholders ValidationSummary (<div>), ValidationMessage (<span>) You can create your own Tag Helpers Check out the source for reference https://github.com/aspnet/Mvc/tree/dev/src/Micros oft.AspNet.Mvc.TagHelpers
  • 56. Key Improvements in ASP.NET 5 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
  • 57. 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
  • 58. Getting Started with ASP.NET 5 Ships with Visual Studio 2015 Walkthroughs and samples at http://asp.net/vnext Documentation at http://docs.asp.net/en/latest Get the code from http://github.com/aspnet Read blogs at http://blogs.msdn.com/b/webdev Try out a nightly build from MyGet https://www.myget.org/F/aspnetvnext My Info idof@sela.co.il @idoFlatow http://bit.ly/flatowblog

Editor's Notes

  1. Other dependencies that people may find relevant: aspnet.diagnostics, server.weblistener
  2. Don’t use void with beta3, it ignores status codes set in the method