Windows Communication Foundation configuration madness

Windows Communication Foundation was created to support the creation of distributed applicacions, trying to give us a library of communication tools, so we can reuse it, without writing the service gateways and service interfaces from scratch. Technologies like web services, evolved, and there are many versions and details to take into account if you want to have secure, relaible and interoperable communication.

The concept of a Service Model, is a great advance. But today, I have to raise my hand, only to point to something makes WCF a convoluted solution. I’m referring to WCF configuration.

If you want to use any WCF feature, beyond the simplest one, quickly you’ll be fighting with the configuration options of this beast. What is the sympton? If you miss some minimal part, your channel doesn’t work. If you miss some configuration option when creating a certificate, if you forget to do one step in a dozen or more of “to do list”, your call will not work. And you have to manage a lot of concepts, like certificates, tokens, issuers, chain of trust, behaviors, bindings, endpoints, identities, custom bindings, factories,  service hosts, channel factories, security options, enumeration types, extensions methods, and …. I could continue for hours.

A minimal example. I just browsing the web, and I found the article

WCF (Windows Communication Foundation) Example

I read there:

Being able to switch the transport layer from TCP (Secure SSL) into HTTP with some simple code, that’s amazing!

Yes, but

I did have some problems, though. The tcpBinding.Security.Mode = SecurityMode.None; is very crucial on both sides. I’m not sure what it does, but it does not turn off the security completely as I have read in my references. There is still SSL encryption, but on a lower level. It is possible to add certificates to the connection, which also makes the connection more secure.

That’s the problem. If you play exploring the different properties and methods of binding and endpoints, you’ll enter a maze without visible exit. Notice that the author is not sure about one of the configuration he is using. And this is only one option: you have dozens more to set, if you want to fine tune your service.

Yes, there is declarative configuration. You can use the WCF configuration wizard:

Ok, can you see the three tabgs, at right? They have more options to fill and understand! Can you see the tree at left? It’s only the top of the iceberg. If you expand the bindings, you’ll enter a new Narnia world:

More properties to fill, and one more tabs! You begin to feel uneasy. If you have courage, create and expand  anything in the advanced branch:

The tree is becoming a amazonic forest. I could take snapshops of each branch this wizard exposes, to publish a complete volume. Most of these options ARE REQUIRED if you want to secure your service, use tokens issued by other systems, define the authentication of the client and service, and more. And my point is: if you fail in filling and defining a minimal part of this stuff, your system is a sand castle, a tower of cards in delicated equilibrium. This is the butterfly effect: a fly of a butterfly in one configuration file, could create an storm in your system. You must pay attention to too many details. It’s common to have to pay attention to details in software development. But I guess in this case, it’s too much: it’s insane to any single human mind.

In other systems, you have lot of options, too (remember the count of properties of any form control?). But you don’t need to master all (or halft) of the details. That is not the case with WCF configuration. This state of affairs sucks. And if you like to write down directly the XML configuration, you have to fight with something like this:

 

There are few uglier thing I met in my 30 years of software development (I could enumerate: EJB configuration, Cocoon ideas, Job Control Language in the old IBM mainframes…).

I have a theory. Enrico Fermi asked: if the extraterrestials exist, where are they? The story is: they exist. They began to study our planet (remember first “flying soucers”? They was seen at Mount Rainer at forties, near Seattle… yes, they were researching the origin of all this…). For decades, they read our literature, watch our film productions, made controlled experiments with some human beings. But when they began to study WCF and EJB configuration, our planet was doomed: they declared it under quarantine, we will be out of contact, isolated from the rest of the galaxy for the next ten thousand years. The humankind is a crazy civilization, there is no hope for our future.

Ok, I must stop whining. WCF has a great service model: now, it can manage JSON, XML, and it’s prepared to be flexible and extensible. But sometimes, we must stop the ball, and balance the flexibility with the accompaning complexity. This post is the result of days of fightings with WCF, WCF examples, documentations and guidelines.

Angel “Java” Lopez
http://www.ajlopez.com/
http://twitter.com/ajlopez

5 thoughts on “Windows Communication Foundation configuration madness

  1. Gopinath Varadharajan

    Angel,

    You’re 100% true, right now i’m fighting one such config WCF [for more than a week[ where it works in my dev and as soon as deploy in prod, you’re toasted….
    Hope Microsoft is Listening… This is exactly the reason we still use Plain old asmx calls
    in all our Projects with .Net 3.5 !!!

    MS wake-up…

    Thanks,

    Gopi

    Reply
  2. Pingback: Time for simplicity? « Angel “Java” Lopez on Blog

  3. Pingback: ¿Es tiempo de volver a la simplicidad? - Angel "Java" Lopez

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s