【发布时间】:2011-09-28 09:13:32
【问题描述】:
我是 WCF 服务的新手。我读到 ASP.NET 和 WCF 服务默认是同步的。但是,我们可以异步实现 ASP.NET 和 WCF 服务。我想知道生成的Web Service Client(Proxy Class)默认是同步的还是异步的?
【问题讨论】:
标签: wcf asynchronous asmx webservice-client synchronous
我是 WCF 服务的新手。我读到 ASP.NET 和 WCF 服务默认是同步的。但是,我们可以异步实现 ASP.NET 和 WCF 服务。我想知道生成的Web Service Client(Proxy Class)默认是同步的还是异步的?
【问题讨论】:
标签: wcf asynchronous asmx webservice-client synchronous
默认为同步。
如果您也需要异步方法签名,则需要为 svcutil.exe 指定 /async
C:\> svcutil (some URL here) /async
或者您需要在 Visual Studio 的 Add Service Reference 对话框中检查 Generate asynchronous operations 选项。
当然 - 一旦你生成了异步方法,你还需要调用那些,显然.....(它们被称为 Begin(YourMethodName) 和 End(YourMethodName) 对于你的每个服务方法)
【讨论】: