I am familiar with the best practices for creating a WCF client by calling the standard method and then closing or interrupting the client upon completion, but I'm curious about asynchronous methods with clients.
I have a manager class that has some pass through events for the added consumption class to get the results of an asynchronous call. For instance:
internal sealed class CommController
{
public event GetClientIdEventHandler ClientIdReceived;
private readonly LocalCommSvcClient _localCommSvcClient = new LocalCommSvcClient();
public CommController()
{
_localCommSvcClient.GetClientIdCompleted += (o, e) => ClientIdReceived(o, e);
}
public void GetClientIdAsync()
{
_localCommSvcClient.GetClientIdAsync();
}
}
But I do not see where the client closes and / or leaves. I could not find many best practices for closing WCF clients, as it relates to asynchronous use. Where should I put .Close () and / or .Abort () calls?
source
share