.Net Meanderings

Richard Blewett's wanderings around .NET

Please read my disclaimer. Subscribe to my RSS feed

Something strange with the NetPeerTcpBinding validator

I've been head down in WCF for a while now, culminating with teaching the first run of DevelopMentor's Essential WCF course last week.

After the Peer to Peer session I was talking to one of the students about the possiblity of using the technology for scenarios other than writing your own version of Windows Live Messenger (which is what all the demos seem to do). I decided to have a play around and along the way discovered a bug in the NetPeerTcpBinding validator.

I'd defined by config file thus:

<bindings>
<netPeerTcpBinding>
<binding name="peer" port="0">
<resolver mode="Custom">
<custom address="http://localhost/stockPeerResolver"
binding="basicHttpBinding" />
</resolver>
<security mode="None" />
</binding>
</netPeerTcpBinding>
</bindings>

The problem was I kept getting an error everytime I tried to create my DuplexChannel. The error read:

"Specified resolver settings are not enough to create a valid resolver.  Please ensure that a ResolverType and an Address is specified for the custom resolver."

Now, since I was developing on Win2003 I had to write my own Peer Resolver (PNRP isn't available on Win2003). However, I was using WCF to get to the resolver so I didn;t actually need to specify a custom type in the binding - just the address and binding to get to the resolver. After puzzling about this for some time - looking at another example I had that was working - I discovered some very strange behavior. Everything works if I modify the config file as folllows:

<bindings>
<netPeerTcpBinding>
<binding name="peer" port="0">
<resolver mode="Custom">
<custom address="http://localhost/stockPeerResolver"
binding="basicHttpBinding"
bindingConfiguration="wtf"/>
</resolver>
<security mode="None" />
</binding>
</netPeerTcpBinding>
<basicHttpBinding>
<binding name="wtf" />
</basicHttpBinding>
</bindings>

So I had to add a reference to a binding configuration that did nothing and it all suddenly works, even though the channel stack is built exactly the same.

10/08/2006 2:25 PM | Comments [427] | #.net

Content © 2003 Richard Blewett | Subscribe to my RSS feed.

Powered by BlogX