One Framework to rule them all…
I have a love-hate relationship with Windows Communication Foundation (WCF). I’ve been doing a lot of work with it lately and depending on the day, I think the acronym might stand for Way Cool Feature or Why is Configuration so Frustrating.
One of the most difficult aspects is that there are too many moving parts. Every solution to a problem requires six or seven different parts, each of which can have a core component and a configuration component and probably another couple components, all of which can inter-operate in a few dozen different ways.
Perhaps this is the ultimate drawback of a system that can do so many things that it’s it’s really hard to come up with an elevator pitch that describes it succinctly.
So whenever I finally figure something out, if possible it’s nice to wrap all that confusement (ridiculous non-word used on purpose) up in something more sane and digestible.
So that was my goal in making a WcfPeerNode to encapsulate the power of the NetPeerTcpBinding to create a peer network of interconnected applications around a WCF service contract.
My goal was to interconnect different ASP.NET applications in a server farm, so that when a user performed an action against one server, resulting in a cache item being dropped and reloaded, all servers in the farm could drop the cache item in a coordinated fashion. This would enable longer cache times on seldom-changed data without sacrificing update speed, without going for a full-blown distributed cache like Memcached or Microsoft project code named Velocity. Sometimes I don’t want to deal with a distributed cache and its requirement that everything be serializable, I just want to be able to drop cache entries in all locations simultaneously!
Sadly, it looks like NetPeerTcpBinding doesn’t work in ASP.NET. Although the following code works just fine in a console application, when run in an ASP.NET website it generates the following error:
System event notifications are not supported under the current context. Server processes, for example, may not support global system event notifications.
Um, gee, thanks.