• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Async ASP.NET Applications
 

Async ASP.NET Applications

on

  • 427 views

Learn how to take advantage of the new async/await operations to keep your applications responsive and avoid the performance bottlenecks. In comparison to how async code has been written with ...

Learn how to take advantage of the new async/await operations to keep your applications responsive and avoid the performance bottlenecks. In comparison to how async code has been written with callbacks, the new way allows for cleaner more readable debug-able code. In this presentation, topics covered: Web Forms, MVC, EF6 some tooling.

Statistics

Views

Total Views
427
Views on SlideShare
427
Embed Views
0

Actions

Likes
0
Downloads
1
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Async ASP.NET Applications Async ASP.NET Applications Presentation Transcript

    • DEVintersection Session AS12 Building Asynchronous ASP.NET Applications
    • 2 © DEVintersection. All rights reserved. http://www.DEVintersection.com Agenda  Quick History  When is Async Useful  Parallelism  Tips & Resources
    • 3 © DEVintersection. All rights reserved. http://www.DEVintersection.com Async in .NET .NET Framework 1.0 / 1.1  1.0 – no async available  1.1 – APM: Async Programming Model IAsyncResult result = StartProcess(..); // continue doing other work // checking result.IsCompleted int final = EndProcess(result);
    • 4 © DEVintersection. All rights reserved. http://www.DEVintersection.com Async in .NET .NET Framework 2.0  EAP: Event-base Async Pattern ProcessCompleted += (sender, e) => { // process the result here }; AsyncProcessStart(…);
    • 5 © DEVintersection. All rights reserved. http://www.DEVintersection.com Async in .NET .NET Framework 4.0  TPL: Task Parallel Library  Task<int> t = ProcessAsync(…); // process other work // check t.Status, t.IsFaulted, etc. int result = t.Result;
    • 6 © DEVintersection. All rights reserved. http://www.DEVintersection.com Async in .NET .NET Framework 4.5  async/await keywords public async Task<int> Process() { int result = await CompleteWork(); return result; }
    • 7 © DEVintersection. All rights reserved. http://www.DEVintersection.com When to Async When is it most useful?  I/O    Parallelism  Long Running Tasks
    • 8 © DEVintersection. All rights reserved. http://www.DEVintersection.com Application Architecture 50 States Web API Web Forms Application Warnings db
    • Demo WebForms
    • 10 © DEVintersection. All rights reserved. http://www.DEVintersection.com WebForms Notes  DO NOT async your Page_Load  RegisterAsyncTask  Set Async=“true” on your .aspx page to enable async pipeline
    • Demo MVC / Web API
    • 12 © DEVintersection. All rights reserved. http://www.DEVintersection.com MVC / Web API Notes  Simple & Transparent  Mark method as async, return Task<T>  Use Entity Framework >= 6.1 for async methods  
    • 13 © DEVintersection. All rights reserved. http://www.DEVintersection.com Parallelism  Task.WhenAll  Task.Run, ThreadPool.QueueUserWorkItem 
    • Demo Parallelism
    • 15 © DEVintersection. All rights reserved. http://www.DEVintersection.com Final Comments  Avoid using Background Threads  Do not use Task.Wait()   Avoid Using Task.ContinueWith   Parallel != Async 
    • 16 © DEVintersection. All rights reserved. http://www.DEVintersection.com Resource & Links  Hanselminutes Podcast – Everything .NET programmers know about Asynchronous Programming is wrong. http://hanselminutes.com/327/everything-net-programmers-know- about-asynchronous-programming-is-wrong  Using Asynchronous Methods in ASP.NET 4.5 http://www.asp.net/web-forms/tutorials/aspnet-45/using-asynchronous- methods-in-aspnet-45  Contact Information 
    • Questions? Thank you! Don’t forget to enter your evaluation of this session using EventBoard!