一、Orchard里异步请求处理线程队列的控制
Orchard的Orchard.WarmupStarter模块,为HttpApplication.BeginRequest时间附加了一个异步处理事件:BeginBeginRequest。
/// <summary>/// 启动 System.Web.HttpApplication.BeginRequest 的异步处理的 System.Web.BeginEventHandler/// System.Web.HttpApplication.BeginRequest 在 ASP.NET 响应请求时作为 HTTP 执行管线链中的第一个事件发生。/// </summary>object extradata)6: {// host is available, process every requests, or file is processedif (!InWarmup() || WarmupUtility.DoBeginRequest(_context))9: {/**** !InWarmup() 不在预热中* WarmupUtility.DoBeginRequest(_context) 找到了与请求URL匹配的静态文件资源*/new DoneAsyncResult(extradata);15: cb(asyncResult);return asyncResult;17: }else19: {new WarmupAsyncResult(cb, extradata);22: Await(asyncResult.Completed);return asyncResult;24: }25: }