Angel \”Java\” Lopez on Blog

March 4, 2009

Windows Communication Foundation configuration madness

Filed under: .NET, Software Development, Windows Communication Foundation — ajlopez @ 10:09 am

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 Comments »

  1. 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

    Comment by Gopinath Varadharajan — March 4, 2009 @ 1:20 pm

  2. [...] Back to web services. Did you visit Wikipedia page about that topic, recently? You’ll find dozens of specifications. You could spend weeks or months, trying to grasp all the technicalities involved in WS-Trust, WS-Addressing, WS-Transaction, WS-PutYourWordHere. I guess REST style adoption is a reaction to such madness (REST style, not REST principles, or RESTFul). Sometimes, libraries are coming to rescue, and sometimes, their fail. My preferred example of a failed trying to hide web service complexity is Windows Communication Foundation (WCF). I wrote about this at Windows Communication Foundation configuration madness. [...]

    Pingback by Time for simplicity? « Angel “Java” Lopez on Blog — October 14, 2009 @ 12:00 pm

  3. [...] Volvamos a los servicios web. ¿Visitaron la página de la Wikipedia sobre el tema, recientemente? Encontrarán docenas de especificaciones. Podrían pasar semanas o meses, tratando de entender y comprender todas los detalles técnicos que se encuentran en WS-Trust, WS-Addressing, WS-Transaction, WS-PutYourWordHere. Pienso que la adopción de estilos REST es una reacción contra esa locura (estilo a la REST, no veo tan adoptado los principios REST, o lo que se llama RESTFul). De vez en cuando, hay librerías que acuden a nuestra ayuda, y otras veces, aún esas librerías fallas. Mi ejemplo preferido de un intento fallido de ocultar la complejidad de los servicios web, es Windows Communication Foundation (WCF). Escribí sobre el tema en Windows Communication Foundation configuration madness. [...]

    Pingback by ¿Es tiempo de volver a la simplicidad? - Angel "Java" Lopez — October 16, 2009 @ 4:17 pm

  4. WCF Configuration – A nightmare!! Microsoft must fix it.

    Comment by aman — October 13, 2012 @ 4:21 pm


RSS feed for comments on this post. TrackBack URI

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

Theme: Shocking Blue Green. Get a free blog at WordPress.com

Follow

Get every new post delivered to your Inbox.

Join 67 other followers

%d bloggers like this: