I'm trying to figure out exactly how to set up my channelFactory and channels - to reuse the same instance vs creating new for each call. I've done a lot of research and I see many conflicting opinions. I'm coming to the following conclusion, but I'm not sure, so I'd like to hear some expert advice.
Using .NET 4, I'm creating a channel factory, adding an endpoint behavior, and then making calls.
Seems like I should reuse the same instance of channel factory but probably safest to make sure it's open first incase it faulted for any reason
If the factory faulted, try factory.close() and in a catch factory.abort()
Seems like there will not be a lot of overhead by doing factory.CreateChannel() for each call and that this is probably safer than sharing channels.
For each call, I should try ((IChannel)_client).Close() and in a catch((IChannel)_client).Abort();
One more thing that I'd like to confirm but I don't know how to test - is let's say I reuse channels and then the channel gets into faulted state - if I didn't code to check the state of the channel first, what would happen there?
Or should I share my channels - auto open with the first call and not close until I close my form?