loading...

Why use WCF?

kspeakman profile image Kasey Speakman Updated on ・2 min read

I was reading through the comments on this amazing MS announcement.

Introducing .NET 5

Amongst them I found a sentiment of some posters: frustration that WCF was being "abandoned". For example.

Please support server-side WCF. If you don't, you're marooning entire classes of apps.

  • Chris Benard

Having used WCF lightly in the past, I was completed flabbergasted that people were upset about it not getting ported to .NET 5. Honestly, I thought the tech was already abandoned by the larger community a while now.

Later someone linked a github issue about this, which was eventually locked for being too heated. I read through all the comments on the issue. I get that people are concerned about interop with legacy applications. But I still don't see why I would create a new WCF service in 2019 on .NET Core. In other words, why would you want to carry that tech forward into .NET 5?

A lot of comments said that it does a lot for you. But many of the features listed either weren't clear to me why I would use them, or were just bad ideas -- like cross service transactions (due to scalability/service-coupling problems). And another portion of them have more standard/interoperable alternatives.

I was just curious if someone who used it out there in internetland could give me a few scenarios where it really shined. For example, some people say scalability, but don't elaborate on what they mean. (Service-level scalability? Developer scalability?) Or hosting the same service on HTTP and UDP -- what scenario has you doing that? Etc.

I suspect there could be some scenario that I am missing (aside from legacy interop). And I genuinely want to understand the ways in which people use it that make it irreplaceable to them.

Is it a case of wanting to keep using the WCF abstractions that you took pains to learn? Or is there really some core scenario that nothing else covers? I saw several people mention this, but there seemed to be no clear example/explanation to that effect. I would love to see some.


Update

Apparently, Microsoft has decided to give to the code for WCF (and WF) to the open source community.

Supporting the community with WF and WCF OSS projects

Posted on by:

kspeakman profile

Kasey Speakman

@kspeakman

collector of ideas. no one of consequence.

Discussion

markdown guide
 

This is actually a quite interesting topic!

So i live in Denmark, where we for some god forsaken reason swear fealty to the overlords from Microsoft in almost all our big corporate companies. I do understand why, having a homogenous approach across an entire IT department, makes it easier to shift man power between projects. Another point is that some people tend to stay at companies for a very long time, and not really keep up to date. So for me, coming in as a consultant, i have multiple times encountered middle aged people, who just didn't want to learn anything new, and who sees new developments as more of the same. They think they can solve everything with what they already have, and yes, they can, but in a frustrating way if you start to consider time-to-market, salary expenses and "the business" in general. I'm baffled WCF is still a thing in so many companies.

Okay, this turned more into a rant they a constructive comment, bear with me though, i work in legacy Microsoft web land every day :D

 

WCF is schema and schema-less.

  • A Schema service is tedious in the short run but it works great for the long run.

  • A schema-less service is easy to implement in the short run but it s*cks monkey balls on the long run.

And WCF does both. Why we should toss it away?.

Now, let's say we want to do a Restful server or WebAPI instead of WCF, something simple and classic:

/user // (GET) to list all the users.

Why WebApi? It is because it's modern (eh?) and it's easy to use and to implement.

It is fine but it's not scalable! What if the table USERS has more than 10K records?. We don't want to pass all information (unless it is a small table) but information paginated.

So, our simple model is not simple anymore and finally, we end passing a lot of parameters and it's here where schema shines!.

 

I'm happy it's going away. I stopped using it to create web services a long time ago. I even reverted back to .NET 2.0 web services so I would not have to use it. Then thankfully Web API came out. Most people created internal web services with WCF and set the transport method to http. That right there told me that even though MS had a vision, it wasn't communicated effectively to developers. WCF was dead from the start. On top of that, WCF configuration was way too complex. WCF was/is a jack of all trades and a master of none.

I totally agree. Why in 2019 you are using WCF escapes me, UNLESS you are doing some INTERNAL interoperability commmunication between systems that do not support http. It would have to be a special case for me to use WCF. The configuration of it is just too complex.

 

One benefit I've seen is being able to give an external third-party (who also builds in .NET) the DLL for the compiled WCF contract.

Easy Peasy for them!

Until...you change the API...until...well...anything changes...and then they need you to hold their hands because something didn't work...

Sorry, that's not a benefit...😋

Well documented REST APIs, for example, are just so much simpler, straightforward, and don't restrict the consumer's choice of tech at all.

So, I dunno why anyone would want to use WCF 🤷‍♂️

 

We still have a lot of WCF services running in our backend. When we first built them, there was no ASP.NET Web API. The WCF doesn't really do anything special for us, though. We are pretty much just using HTTP transport with no special settings. We're going to migrate all the WCF endpoints to REST, but it is annoying because they work fine as they are. It's just a chore to change them all just to end up with it working the same as it did originally.

WCF is super-powerful (and super-complicated because of it). There are probably people out there that are using the really complicated features and for them transitioning out of WCF is probably a real issue.

 

If you are starting a new project today, it won't make any sense to use that framework.

If you are stuck with WCF services that were developed years ago, you should listen to .NET rocks' recent podcast on how to migrate from there.

dotnetrocks.com/?show=1644

 

There are many .net applications where complex objects are passed between server and Client. Now if someone wants to port those to net core they need WCF for various reasons.

One of them is that wcf helps with automatic Client code Generation with complex types. Application can have Dictionary-types in objects that are used for transportation of data - that is a lot of work to re-implement without wcf.
Also the performance of wcf is very good with certain binary message encoding options. Hard to replace.

So then, these special applications that transport a lot of data between server and client, are difficult to port to net core