(Assuming a WCF method called \"MyFunction\")
Currently, to support canceling a WCF request, I\'m using the BeginMyFunction/EndMyFunction methods generated by svcuti
Easiest way I know of to do this with a WCF Client and the Task based async pattern is to register an Abort action with the cancellation token
private async Task CallOrAbortMyServiceAsync(CancellationToken cancellation)
{
var client = new SomeServiceClient();
cancellation.Register(() => client.Abort());
try
{
await client.CallMyServiceAsync();
} catch (CommunicationObjectAbortedException) {
// This will be called when you are cancelled, or some other fault.
}
}