In previous two posts I described the way how to develop and deploy WCF and WebAPI services.
- Implementing REST service using WebAPI v2 hosted WorkerRole
- Implementing REST service in WCF hosted WorkerRole
Bellow are my brief observations and source code attached.
- More robust technology stack
- General purpose, suitable for many different communication scenarios (SOAP, REST, binary via different transport mechanism - tcp, HTTP, queuing, etc)
- Configurable via code as well as a configuration file
- Long learning curve
- Straightforward, one purpose only framework
- Oriented to REST/HTTP only
- Configurable only via code (code first approach)
- Fully unit-testable, mock-able
- Short learning curve
My goal was to develop REST service and it looks like WebAPI fit more to it because of the following reasons:
- WebAPI is more resource oriented (core idea of REST), WCF is more RPC oriented
- WebAPI provides better control over REST API definition in the form of routing rules
- Open source,
- we can look "under the hood" and see what's going on there
- better fine tuning and maintenance
- Versioning: can run different controllers sidebyside
- Much simple to learn
- Code first configuration approach is very straightforward
- Developed with unit testing in a mind which gives the developers opportunity to write isolated functional tests with mocking legacy dependencies (file, network, etc.)
All in all, I'd like to use proper framework for a task I need to do.
Open topic: performance. That's the topic for my next post.