locked
How to call wcf service Asynchronously RRS feed

  • Question

  • User88744855 posted

    if wcf service is design the below way then please guide me how call Add() function Asynchronously from client side. thanks

    [ServiceContract]
    public interface IAddTwoNumbers
    {
        // If the asynchronous method pair
        // appears on the client channel, the client can call 
        // them asynchronously to prevent blocking.
        [OperationContract (AsyncPattern=true)]
        IAsyncResult BeginAdd(int a, int b, AsyncCallback cb, AsyncState s);
    
        [OperationContract]
        int EndAdd(IAsyncResult r);
    
        // This is a synchronous version of the BeginAdd/EndAdd pair.
        // It appears in the client channel code by default. 
        [OperationContract]
        int Add(int a, int b);
       }
    Friday, January 31, 2014 8:48 AM

Answers