In this post I cover putting together a simple http server with a video on creating the http server, setting a status code, which provides the basic elements you need to further build out a fully featured server. This post is paired with a video too.
Ah, part 2! If you’re looking for part 1, click this link. Review: In the last blog entry I went … More
So often I end up putting together some RESTful services (or the intent is to at least build them with … More
I’ve had the pleasure of working with WCF on three specific projects that have brought me to this blog entry. I haven’t used WCF on only three projects, there are just three that have brought me to write this entry. I’ve used WCF a lot, since back when it was a beta. WCF is great when creating SOAP services and you aren’t too worried about the extra overhead. WCF is great for what it does, for the ideas behind what it does.
But writing RESTful web services doesn’t seem to be its strong point. On two huge projects WCF has basically been dropped, or so scaled back one really can’t honestly say that WCF is used, and either an alternate framework has been used or a LOT of custom code ends up being written.
The first time I used WCF to implement RESTful service was at Webtrends. Albeit, there is a single service that returns all types of awesome reporting goodness, however to implement basic auth, logging, polling, and a whole host of other Enterprise Scale needs we had to custom roll most of it. Keep in mind, when doing this the WCF REST capabilities were brand shiny and new, so there were a few issues to work out. Now, maybe WCF could be used and a lot of it would be built in. However as it was, we easily spent 60% of the time writing custom bits because WCF just didn’t have the right options with the right bindings.
But I digress, I recently implemented an architecture using RESTful services using WCF. But now I’ve come to find myself dropping WCF because of the back and forth and going with ASP.NET MVC controller actions to return JSON instead. With that, here’s to the lean mean controller actions rockin’ the JSON. Here’s what I’ve done to port everything from WCF to MVC.
To see what I had done, except on a smaller scale, check out my previous blog entry on ASP.NET MVC with a WCF project smack in the middle of it. This will give you an idea of what I was using the WCF services for, merely to provide JSON results via RESTful services to an ASP.NET MVC front end requesting data with jQuery.
This is how I’ve setup the controller to return JSON results via an action.