As I wrote in the previous blog post, I spent some time comparing WCF and WebAPI as a frameworks for building the services and deploying them into Azure.
Just to recap, our goal is to build a sample REST service, in this post, using WCF hosted in Azure.
In this blog post I'll describe how to build a sample app using ASP.NET WebAPI 2 technology stack.
Define contract with the its implementation within API controller
The great thing is that WebAPI is built with convention over configuration mindset ;) More information can be found here
Add a startup class and use WebAPI.
Learned from the previous post, we need to open the port and run the service in the elevated permissions.
Selhost WebAPI in the worker role using startup configuration.
I like that the configuration is defined separately out of the worker start task (separation of concerns). In addition, WebAPI enables to have a complete control over routes and instead of defining the routing rules, it's possible to use routing via attributes, which rocks!
That's all. Now, it's possible to run it locally via emulator as well as deploy it to the Azure.