|
I love C# and .NET, but WCF is a true source of frustration. It isn't horribly bad, but there is nothing good about it either. It's too complex, too messy, and too "Microsofty" for lack of a better word. Many layers of abstraction, hidden magic in XML files (which you can of course turn off, but then you need to know how to), and so on. Nevertheless, shares of coders blindly use WCF, "because Microsoft tells us to". Bullshit, and what a waste. There are very few modern use cases where WCF is the best option out there. If you want to make a RESTful API with .NET, please consider: * ASP.NET MVC Web API
* ServiceStack
* Nancy
Nancy is basically Ruby's Sinatra but then on .NET.ServiceStack recently became commercial, but it still is the best designed API library I've ever seen, in any language. It makes you focus more on the actual data inside each request and response, and less on the form of that data (is it a query parameter, JSON POST field, or part of a fancy URL? who cares, design your messages first and then figure out what the URLs should look like). The result of this is that somehow you tend to automatically design forward-compatible, extensible API endpoints. I guess you really have to feel it to believe it, but I kid you not, with ServiceStack, it feels like your API designs itself in front of your eyes. If anyone knows anything like ServiceStack on any other language, please tell me and I'm going to give you hugs. Finally, MVC Web API is basically Rails's API controllers ported to C#. It has a tad too much magic for my taste, but it's a familiar and decent pattern that just works. Please, please, let's just bury WCF and embrace the true goodies in the .NET open source ecosystem. It's nice that WCF got open sourced, but it's still a mess. If you really must go the "because Microsoft!" route, please just use ASP.NET MVC (also open source, and in active development). |
As far as I can tell, Microsoft doesn't really push WCF any more simply because the use-cases are fewer and/or irrelevant in the current Web Service landscape.
I also get the feeling that many people commenting here didn't need to work with WS-* and associated technologies at the time WCF didn't exist. After its release it really was a choice between the lesser of two evils. But at the time, WCF was the mischievous kid who didn't do his homework, and everything else was the direct spawn of Satan.
A reminder of what WCF is (Wikipedia):
> a runtime and a set of APIs in the .NET Framework for building connected, service-oriented applications
> WCF is a tool often used to implement and deploy a service-oriented architecture (SOA)
For people who were around during the SOA dark ages, I won't be surprised if reading that sent shivers down your spine. Thankfully SOA, as it was evangelized, is pretty much dead. For everything else, these days better data-interchange technologies exist.