相关疑难解决方法(0)

如何异步调用wcf服务

如果wcf服务设计如下,那么请指导我如何从客户端调用Add()函数Asynchronously.谢谢

[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);
   }
Run Code Online (Sandbox Code Playgroud)

.net c# wcf asynchronous

2
推荐指数
1
解决办法
2003
查看次数

标签 统计

.net ×1

asynchronous ×1

c# ×1

wcf ×1