await和async在C#一般处理程序(ashx)中的使用

 public class hello : HttpTaskAsyncHandler, IReadOnlySessionState
    {

       
        public IFetchServise fetch { get; set; }


        public override async Task ProcessRequestAsync(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            var name = await fetch.RandomFortuneAsync();
            context.Response.Write(name);
        }

       

    
    }

  

posted @ 2018-03-27 14:41  t_tian  阅读(838)  评论(1编辑  收藏  举报