一、WCF使用异步处理
1、设置OperationContract AsyncPatten=True
2、BeginTestAsync和EndTestAysnc接口定义
3、将同步方法改成异步方法。
4、见二
二、将同步方法改成异步方法
1、转载 https://www.cnblogs.com/DebugLZQ/archive/2013/04/07/3006275.html
//------进行异步封装--简化1:Action简化
static void ShowUriContentAsync1(string uri)
{
Action<string> showUriContentDelegate = ShowUriContent;
showUriContentDelegate.BeginInvoke(uri, ShowUriContentCompleted1, showUriContentDelegate);
}
static void ShowUriContentCompleted1(IAsyncResult result)
{
(result.AsyncState as Action<string>).EndInvoke(result);
}
2、
//------简化2:匿名方法简化
static void ShowUriContentAsync2(string uri)
{