I haven’t tried doing any WCF (formerly and still known as Indigo) development in probably 6 months or so, and some things have changed since then. Also, this is the first time I’ve tried implementing a duplex contract. I made some mistakes along the way, due in part to the fact that the sample code in the November CTP doesn’t match the docs (no surprise there). Over all, though, it was way easier than I thought it might be. Certainly easier then .NET Remoting, and the fact that there’s a built-in notion of a duplex contract solves tons of problems.
Anyway, I was trying to get my client to work, and for the life of me couldn’t figure out the errors I was getting, until it finally dawned on me. Here’s what I had:
static void Main(string args)
InstanceContext site = new InstanceContext(new CallbackHandler());
// Create a proxy with the given client endpoint configuration.
using (MyDuplexProxy proxy = new MyDuplexProxy(site))
It’s probably obvious to everyone who isn’t me why this won’t work. You can’t dispose of the proxy and still expect a callback. Now that I say that it makes sense, but it didn’t occur to me for a while, since the callback itself isn’t on the proxy class. So, I changed one line to this:
and everything worked out swimmingly. I continue to be impressed with how well thought out Indigo is. While many people like to point out how many mistakes MS has made over the years, you certainly can’t fault them for not learning from them.
Powered by: newtelligence dasBlog 2.3.9074.18820
The opinions expressed herein are my own personal opinions and do not represent
my employer's view in any way.
© Copyright 2017, Patrick Cauldwell