Announcing ASP.NET Web API Recipes

81iUYKuTehL._SL1500_It is my pleasure to announce that this summer my ASP.NET Web API book will be released. It’s entitled "ASP.NET Web API Recipes", and will be published by Apress.

While the publication date is not set in stone yet (probably early August), you can already pre-order at:

The idea behind the book is quite simple – to discuss and dissect some of the most common problems and issues you might encounter in your work with Web API solutions.

There is going to be a total of 12 chapters with about 10 recipes per chapter (the number varies obviously). You will also get a full VS project with source code per each recipe.


The table of contents is as follows:

  • – Chapter 1: ASP.NET Web API in ASP.NET
  • – Chapter 2: Hosting ASP.NET Web API outside of IIS
  • – Chapter 3: Routing
  • – Chapter 4: Content Negotiation and Media Types
  • – Chapter 5: Configuration and Customization
  • – Chapter 6: Embracing HTTP with ASP.NET Web API
  • – Chapter 7: Exceptions, Troubleshooting and Documenting
  • – Chapter 8: Cross Domain and Push Communication
  • – Chapter 9: Dependency Injection
  • – Chapter 10: Securing an ASP.NET Web API Service
  • – Chapter 11: Testing Your ASP.NET Web API
  • – Chapter 12: OData

Each recipe contains 4 sections:

  • Problem – short definition of a problem/issue that will be addressed in the recipe
  • Solution – quick summary of how it can be resolved/implemented in Web API
  • How It Works – a look behind the scenes – into Web API source code, into source of some external library that might be used or even into an RFC that defines a relevant standard
  • The Code – a dive into the code needed to solve your problem

and takes more or less 3-4 pages. Below are some sample recipes, just to give you a taste of what’s coming:

  • – Recipe 3-11 Localize Routes
  • – Recipe 5-1 Throttling ASP.NET Web API
  • – Recipe 6-8 Versioning With Attribute Routing
  • – Recipe 8-4 Support Streaming and Push from Web API
  • – Recipe 9-5 Write a Custom DI Adapter
  • – Recipe 11-5 Simplify Tests with IHttpActionResult

If you are used to the blog format, and enjoy the style used here, I am sure (or, well, I hope) you will find the book enjoyable too.

Also, this is by no means an attempt to create an A-Z compendium/reference of ASP.NET Web API – there are other great books that have done that already. Instead I focus on this very readable, no-nonsense, straight-to-the-point, problem-solution format which will allow us (me, and you the reader) to explore specific scenarios directly.

Apress offers an Alpha program so you can already get an ebook with some of the draft/early versions of a number of chapters.


  • Vitalii Biliienko

    Great news! Is it a book I would grab if I haven’t worked with Web API before or should I go and learn stuff first? I have enough experience with ASP.NET MVC though

  • Pingback: Dew Drop – May 22, 2014 (#1782) | Morning Dew()

  • Tugberk Ugurlu


  • Simon Cowie

    Nice one. This has been a really helpful blog so imagine the book will be great.

  • Cecil L. Phillip

    I’m sold!!

  • Lars Michael

    Sounds good. How will your book place itself compared to RESTFul Web Services Cookbook ( Except from being more technology (ASP.NET) specific.

  • Abhishek jain

    Congrats Filip!

  • Imar Spaanjaars

    Hi there,

    Does the book come with the source code as mentioned in this post? It’s not available on the Apress website yet. Maybe they are still working on the upload?

    BTW: great book with lots of useful insights. It has helped me a lot.



    • Filip W

      thanks! I’ve put all the source code here on Github as well

      • Imar Spaanjaars

        Hi Filip,

        Excellent, thanks. Searched high and low for this the other day but couldn’t find it. Thanks for the speedy reply.


  • A. Brininstool

    Flip I have purchased your new Web API Recipes. I am attempting to apply recipe 11-6 Test Routes. The recipe indicates that it will work with attribute routing, but in the Route Context, the config.Routes.GetRouteDate(request) comes back null (I don’t use any central routing at all). What do I need to do to configure or register my direct routes and get this to work? Thanks.

    • Filip W

      Did you call both:


      in your fixture setup?
      Also, be aware of this one line issue, it was only discovered after the book went to print. The github code is up to date.

      • A. Brininstool

        Hi. Yes I had called those setup methods. I have applied the issue fix and done some testing. It is working better now, in that it does match Controller methods more than just Get, Post, Put, and Delete. However, the code does not truly test my direct routes, it matches the Controller against the Uri, but it does not truly match the direct route against the Uri. It takes the HTTP Verb and finds all of the methods on the Controller matching those verbs. When running the test, the code only matches the test Controller method against the signatures of the previously found Controller methods matching the verb. It does NOT do a match against the Uri and the [Route] set on the Controller method. For instance, the test below passes when it should fail. The Controller setup is:

        //Controller Route Prefix
        public class AccountController : ApiController

        // SetPassword action Verb and Route
        public IHttpActionResult SetPassword(string id, AccountDTO account)

        The Test looks like this:

        public void SetPasswordByUserNameRouteIsCorrect()
        var request = new HttpRequestMessage(HttpMethod.Put,
        “”); //Should not match route for Set Password
        var tester = new RouteContext(_config, request);
        Assert.AreEqual(typeof(AccountController), tester.ControllerType);
        ReflectionHelpers.GetMethodInfo((AccountController controller) =>
        controller.SetPassword(“MyUserName”, null))));

        The proper Uri to match SetPassword should be:

        Again, I don’t use ANY central routing only direct routing on the Controller.

        • Filip W

          yeah the code was simplified to check the mappings only. However, to run fully fledged action selection, you just need to tweak it a little bit. I have blogged about it before here – this should solve you problem :)

          • A. Brininstool

            I have it working better now by interrogating the Sub Routes, Data Tokens “actions” key and matching the MethodInfo on those action descriptors with the test Controller MethodInfo.