I'm working on a project that is consuming SOAP services via WCF. Initially, we used generated service references because it was easy to get started. This provides ChannelFactory
caching and task-based async methods out of the box, which is clearly desirable.
We've recently switched to using service interfaces and instantiating our own ChannelFactory
. We treat the ChannelFactory
as a singleton object to cache it. On caching the ChannelFactory
-- I've been told that a ChannelFactory
can go bad if, for example, one of its channels fault. Is this a real concern?
My second question is in regards to using task-based async calls like the ones generated when using the service reference. How is this done when using a ChannelFactory<T>
? I understand that you can annotate methods on T
with [OperationContract(AsyncPattern = true)]
, but these return IAsyncResult
and not Task
.
Any help would be appreciated.