Paging with ASP.NET Web API OData

A common requirement for web applications is to expose partial results from a larger set of data. Maybe you want your users to be able to browse through a collection of movies that they can stream. But you don’t want to display all of the thousands of movie titles you have available, just the first…

Writing tests for an ASP.NET Web API service

It’s important to test any service you write to make sure that it’s behaving the way you expect it to. In this blog post, I’ll go through the main ways of testing a Web API service, exploring the benefits and drawbacks of each option so that you can test your service effectively. Web API testing…


Building Real-time Web Apps with ASP.NET WebAPI and WebSockets

WebSocket is a recent technology that provides two-way communication over a TCP connection. This allows us to create real-time web apps where servers can push data to clients. In this blog post, I’ll demonstrate how this can be done by building a simple chat app using ASP.NET WebAPI and ASP.NET’s new support for WebSockets in…


Error Handling in ASP.NET WebAPI

WebAPI is a brand new framework that makes it easy to build HTTP services. As such, it provides several features that make it easy to send back useful and informative error messages in a variety of cases. In this post, I’ll go over some of these capabilities. Note: Not all of the features I mention…


Writing a Lightweight Web Service using WebApi Building Blocks

Don’t you wish you could write a web service this easily:   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();   Well, with last week’s release of the Web API beta bits, now you can. Web API is a brand new framework that makes it easy to build HTTP services. You can learn more about Web API here:….