Author: Henrik's Blog | Posted on: 2/24/2012 6:03:00 AM | Views : 1217

ASP.NET Web API supports asynchronous actions using the new Task-based programming model introduced in .NET 4. In .NET 4.5 the model has improved further and in addition is supported directly from C# using the new async and await keywords (see " Visual Studio Asynchronous Programming " for background). What this means is that you can have actions that look like this: 1: public Task< string []> GetContent( string topic) 2: { 3: ... 4: } as well as 1: public Task<HttpResponseMessage> GetContent( string topic) 2: { 3: ... 4: } and even this 1: public Task GetContent( string topic) 2: { 3: ... 4: } The benefit of writing Task-based actions is that you don't block a thread on the server even if things take a long time to complete and...(read more) ...

Go to the complete details ...