ASP.NET Web API Round-Up @noug

  • 5,523 views
Uploaded on

Slides for my Online Usergroup talk on 27th february 2012 about the new ASP.NET Web API from Microsoft. …

Slides for my Online Usergroup talk on 27th february 2012 about the new ASP.NET Web API from Microsoft.
http://online-usergroup.de/termine.20120227.ashx

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
5,523
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. WCF ASP.NET Web API// Round-UpAlexander Zeitler
  • 2. Alexander Zeitlerblog.alexonasp.net | @AlexZeitler
  • 3. ?
  • 4. http://www.asp.net/web-api Only one HTTP / ReST / Hypermedia API Fx from MS „Best of both worlds“
  • 5. WCF to ASP.NET Web API WCF Web API ASP.NET Web API Service  Web API controller Operation  Action Service contract  - Endpoint  - URI templates  ASP.NET Routing Message handlers  Same Formatters  Same Filters, model Operation handlers  binders
  • 6. WCF to ASP.NET Web API ApiController (!=Controller, no common BaseClass) ASP.NET Routing (MapHttpRoute)  Convention over Configuration Web API to go / NuGet Packages  Web API hosted in ASP.NET: AspNetWebApi  Self-hosted Web API: AspNetWebApi.Selfhost  HttpClient including XML and JSON formatters: System.Net.Http.Formatting  JsonValue for navigating and manipulating JSON: System.Json Go Live License
  • 7. WCF to ASP.NET Web API Safe for production? http://stackoverflow.com/questions/9402034/start-developing-with-mvc4-web-api-today-using-beta
  • 8. Demo | File | New | WebAPI
  • 9. Demo | ContactsWeb
  • 10. Demo | CommentsWeb
  • 11. Node-style Web API? WTF?LiteWebServer server = new LiteWebServer("http://localhost");server.Get("/Hello", (r) => new HttpResponseMessage() { Content = new StringContent("Hello World!")});server.Post("/Echo", (r) => new HttpResponseMessage() { Content = new StringContent( r.Content.ReadAsStringAsync().Result )});server.Open(); http://blogs.msdn.com/b/youssefm/archive/2012/02/24/writing-a-lightweight-web-service-using-webapi-building-blocks.aspx
  • 12. Async FTW! http://www.tugberkugurlu.com/archive/my-take-on-task-base-asynchronous-programming-in-c-sharp-5-0-and-asp-net-mvc-web-applications
  • 13. Logging with ELMAHpublic class ElmahErrorAttribute : System.Web.Http.Filters.ExceptionFilterAttributeprivate void Configure(HttpConfiguration httpConfiguration) { httpConfiguration.Filters.Add( new ElmahErrorAttribute() ); httpConfiguration.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); } http://www.tugberkugurlu.com/archive/asp-net-web-api-and-elmah-integration
  • 14. ASP.NET Web API | Ressources http://www.asp.net/web-api http://blogs.msdn.com/b/henrikn/ http://weblogs.asp.net/scottgu/archive/tags/Web+API /default.aspx http://stackoverflow.com/questions/tagged/asp.net- web-api https://github.com/ChristianWeyer/Thinktecture.Web. Http http://blog.alexonasp.net http://aspnet.uservoice.com/forums/147201-web- api/suggestions/2618312-allow-for-non- asynchronous-calls-to-the-web-api
  • 15. http://www.flickr.com/photos/crystaljingsr/3914729343/
  • 16. http://www.flickr.com/photos/nateone/3768979925