I just want to make sure I'm following the right approach. In my application for particular 开发者_Go百科service I have one static ChannelFactory (as it's instance thread safe), and every time I need to comunicate with WCF Service I create a channel with CreateChannel , use that channel and then close it. However I bumped into one opinion that storing channel itself in static member, and reusing it is also right (author of that opinion also claims that creation of channels on PerCall basis will decrease performance significantly). What's the best approach?
Thanks,Pawel
Well I suggest you do your own performance testing, but I think you'll find that with your approach you won't have any problem creating many thousands of channels per second depending on your hardware. In my opinion for most use cases it won't matter much at all.
If you are interested, Michele Bustamante (from IDesign.net) goes into the discussion here with code samples.
精彩评论