Introduction to what is happening with ASP.NET vNext as of summer 2014. This is a mix of public information and my personal interpretations of announcements and open source ASP.NET code.
7. ASP.NET – things not in Vnext
IIS
.NET BCL
ASP.NET
ASP.NET MVC ASP.NET Web API
HTTP
Modules
ASP.NET WebForms
HTTP
Handlers
Request
pipeline
HTTP
Context
et al.
Caching Session
State
8. ASP.NET vNext – Guiding Principles
No dependency on System.Web
this is huge
Cross platform
Low friction
(this is my interpretation)
9. No System.Web
The System.Web namespace supplies classes and
interfaces that enable browser-server communication.
This namespace includes the HttpRequest class,
which provides extensive information about the current
HTTP request; the HttpResponse class, which
manages HTTP output to the client; and the
HttpServerUtility class, which provides access to
server-side utilities and processes. System.Web also
includes classes for cookie manipulation, file transfer,
exception information, and output cache control.
10. No System.Web
System.Web is at the very core of ASP.NET
Context
Request
Response
Session
Pipeline (that nasty global.asax stuff)
WebForms is intimately coupled to System.Web
13. No System.Web
Unless you want to…
Because legacy code
Because WebForms
Which still will improved on
14. ASP.NET – and things changes in Vnext
IIS
.NET BCL
ASP.NET
ASP.NET MVC ASP.NET Web API
HTTP
Modules
ASP.NET WebForms
HTTP
Handlers
Request
pipeline
HTTP
Context
Caching Session
State
15. MVC + WebAPI
…will be unified
One controller type
Micorsoft.AspNet.Mvc.Controller
Or POCO controllers
16. MVC + WebAPI
One depedency injection solution
…registering ”services” during startup.
…inject in all
…including SignalR
18. ASP.NET – and things changed in Vnext
IIS
.NET BCL
ASP.NET
ASP.NET MVC ASP.NET Web API
HTTP
Modules
ASP.NET WebForms
HTTP
Handlers
Request
pipeline
HTTP
Context
Caching Session
State
20. Framework not in GAC
Bin deploy
Side-by-side deploy
Good or bad for operations?
21. ASP.NET – and things changed in Vnext
IIS
.NET BCL
ASP.NET
ASP.NET MVC ASP.NET Web API
HTTP
Modules
ASP.NET WebForms
HTTP
Handlers
Request
pipeline
HTTP
Context
Caching Session
State
25. OWIN – Response Environment
Required Key Name
Yes "owin.ResponseBody"
Yes "owin.ResponseHeaders"
No "owin.ResponseStatusCode"
No "owin.ResponseReasonPhrase"
No
"owin.ResponseProtocol"
26. OWIN in vNext
public class Startup
{
public void Configure(IBuilder app)
{
app.UseOwin(x => x.UseNancy());
}
}
27. OWIN in vNext
public class Startup
{
public void Configure(IBuilder app)
{
var buildFunc = app.UseOwin();
buildFunc(next => MyApp);
}
public Task MyApp(IDictionary<string, object> environment)
{
var responseText = "Hello World";
var responseBytes = Encoding.UTF8.GetBytes(responseText);
var responseStream = (Stream)environment["owin.ResponseBody"];
var responseHeaders = (IDictionary<string, string[]>)environment["owin.ResponseHeaders"]
responseHeaders["Content-Length"] =
new string[] { responseBytes.Length.ToString(CultureInfo.InvariantCulture) };
responseHeaders["Content-Type"] = new string[] { "text/plain" };
return responseStream.WriteAsync(responseBytes, 0, responseBytes.Length);
}
}
28. OWIN in vNext
public class Startup
{
public void Configure(IBuilder app)
{
app.UseOwin(x => x.UseNancy());
}
}
33. K Runtime
Command line for all things vNext
Or so it seems it will be
K Version Manager (kvm)
K Package Manager (kpm)
K Runtime Environment (kre)
K
35. K Version Manager
PS C:projectsvNext-playHelloNancy> kvm list
Active Version Runtime Architecture Location
------ ------- ------- ------------ --------
1.0.0-alpha2 svr50 x86 C:Userschors_000.krepackages
1.0.0-alpha2 svrc50 x86 C:Userschors_000.krepackages
* 1.0.0-alpha3-10201 svr50 x86 C:Userschors_000.krepackages
PS C:projectsvNext-playHelloNancy> kvm use 1.0.0-alpha3*
Adding C:Userschors_000.krepackagesKRE-svr50-x86.1.0.0-alpha3*bin to process PATH
47. Why Do I Care?
More OWIN
Better opportunity for .NET OSS
OWIN Middleware eco system will blosson
Nice modular way of working
48. Why Do I Care?
Modularized .NET + bin deploy
Smaller footprint on disk and memory (!)
Faster development from MS on some parts
Side-by-side on different versions
49. Why Do I Care?
K and cross platform:
Broader potential developer crowd
K as enabler for own tooling
K as enabler for 3rd party / OSS tooling
(and I’m not thinking about Jetbrains)
53. Exercise: URL shortener
Follow shortened url
HTTP GET “/shorts” Redirect to original URL
Submit URL to shorten
HTTP POST “/” Shorten, store, return shortened URL
Get front page
HTTP GET “/” Web page with a simple form
55. Things to do a long the way
Play with dynamic compile
Switch KRE with kvm
Write some stupid OWIN middleware
Do the URL shortener in MVC
Do the URL shortener in raw OWIN
K pack your app and move it
Add dependency to project.json, save and watch projects references
If CTP3 add xUnit test project as ASP.NET vNEXT class lib