8021

webapi batch requests

Question:

I am looking for a way to batch requests to the server. I found a post by Brad Wilson outlining how to make a batch handler using a message hanlder <a href="http://bradwilson.typepad.com/blog/2012/06/batching-handler-for-web-api.html#more" rel="nofollow">http://bradwilson.typepad.com/blog/2012/06/batching-handler-for-web-api.html#more</a> but I wasn't able to get this working.

first I had compile errors because webapi did not understand "route-specific endpoint handler" like Brad's example used. there were also problems with the media type and/or formatter (can't remember which). My next attempt was to make a batch controller. so instead of a batch handler I had a batch controller. I almost has this working except when I used the MessageHandlerInvoker to call the individual commands I got exceptions about the additional handlers I have regsstered (1 for logging request/response and another to mimic user authentication).

At that point I stopped and reverted back to individual requests, not ideal, but it works.

My environment:

<ul><li>.net 4.0</li> <li>VS 2010</li> <li>mvc 4 front end (calls webapi)</li> <li>webapi as a service tier</li> </ul>

Has anyone else had any success with batched messages and webapi?

Answer1:

To be able to use per-route handlers you need ASP.NET Web API RTM which was only released yesterday (at the time when Brad wrote the article, it would only work with nightly MyGet feed builds or against Codeplex source).

You can get entire <a href="http://www.asp.net/mvc/mvc4" rel="nofollow">MVC4 RTM here</a> or simply off Nuget.

Recommend

  • ADAL js does not work in IE when acquiring token for remote endpoint when website url is added to “T
  • Dynamic JavaScript returned by webapi
  • Web API Routing - No action was found on the controller that matches the request
  • BackgroundMediaPlayer set Uri source of Media library item
  • Cleave.js Phone CA
  • ResponseBuilder is not working when used with entity object
  • Is it possible to control programs with Javascript?
  • IF statement formatting best-practise, what's your style?
  • why my app based on boost::asio didn't accept new connection
  • ASPNetCore MVC Routing Let Server Handle Specific Route
  • How dotnet build chooses the output name
  • Unable to connect to OnVif enabled camera using C#
  • Setting WPF Window Background to Resource Dictionary Brush User Setting
  • Get localized short date pattern as String?
  • Laravel 4 routing not working due to .htaccess file?
  • Iron Router: How do I send data to the layout?
  • Can I have a variable number of URI parameters or key-value pairs in Laravel 4?
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • How to programatically 'login' a user based on 'remember me' cookie when using j
  • Django model inheritance, filtering models
  • Multicolored edittext hint
  • Copy to all folders batch file?
  • How can I set a binding to a Combox in a UserControl?
  • Does it make sense to call System.gc() and Thread.sleep() when working on Bitmaps?
  • Installing Apache MyFaces 2 on WildFly 8.2.0
  • azure media services - The request body is too large and exceeds the maximum permissible limit
  • Using jQuery closest() method with class selector
  • Array.prototype.includes - not transformed with babel
  • Problems to linebreak with an int in JLabel
  • Compare two NSDates in iPhone
  • Matrix multiplication with MKL
  • trying to dynamically update Highchart column chart but series undefined
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • What are the advantages and disadvantages of reading an entire file into a single String as opposed
  • How do I configure my settings file to work with unit tests?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Binding checkboxes to object values in AngularJs
  • Converting MP3 duration time