【问题标题】:Whether generated WCF Service Client is Synchronous or Asynchronous by default?生成的 WCF 服务客户端默认是同步的还是异步的?
【发布时间】:2011-09-28 09:13:32
【问题描述】:

我是 WCF 服务的新手。我读到 ASP.NET 和 WCF 服务默认是同步的。但是,我们可以异步实现 ASP.NET 和 WCF 服务。我想知道生成的Web Service Client(Proxy Class)默认是同步的还是异步的?

【问题讨论】:

    标签: wcf asynchronous asmx webservice-client synchronous


    【解决方案1】:

    默认为同步

    如果您也需要异步方法签名,则需要为 svcutil.exe 指定 /async

    C:\>  svcutil (some URL here)  /async
    

    或者您需要在 Visual Studio 的 Add Service Reference 对话框中检查 Generate asynchronous operations 选项。

    当然 - 一旦你生成了异步方法,你还需要调用那些,显然.....(它们被称为 Begin(YourMethodName)End(YourMethodName) 对于你的每个服务方法)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-03
      • 1970-01-01
      • 2011-09-15
      • 1970-01-01
      相关资源
      最近更新 更多