2
votes

When a WCF service is called in an async manner from a client, then we know that the client app is NOT blocked.

But is the thread on the WCF side blocked while executing the async method call OR the WCF releases the thread it uses to initiate the method call ?

For example, if I call the 'Add' method in an async manner from an ASP.Net app, as in code below, will the service instance in back-end wait till method completes? The WCF uses an InstanceContext of PerCall.

        CalculatorClient client = new CalculatorClient();

        // AddAsync
        double value1 = 100.00D;
        double value2 = 15.99D;
        client.AddCompleted += new EventHandler<AddCompletedEventArgs>(AddCallback);
        client.AddAsync(value1, value2);
1

1 Answers

4
votes

WCF support for asynchronous calls are strictly a client-side feature only.

In-fact the service has no way (and should not have) of telling the difference between two clients, one making a synchronous call and the other making an asynchronous call.

This is true regardless of whether the client is making a call via an async proxy, or directly via async invocation.

It is easy to show this is true with a thought experiment; ANY wcf service can be called asynchronously, and additionally this is REGARDLESS of the binding selected - therefore this must be solely a client-side facility.