MvcApplication 在哪个时间点调用 HttpAplications 事件,例如:
...
public event EventHandler PreSendRequestHeaders;
public event EventHandler PostResolveRequestCache;
public event EventHandler PreSendRequestContent;
public event EventHandler PostMapRequestHandler;
public event EventHandler PostLogRequest;
public event EventHandler RequestCompleted;
...
它如何知道(上一个事件的)上一个 Handler 什么时候完成?是同步调用的 Handler 一个接一个准备好了吗?这里有一个例子:
// gets called through HttpApplication.BeginRequest event
protected void Application_BeginRequest() {
Thread.Sleep(60000);
// Waits very long
Debug.WriteLine("begin");
}
// gets invoked after BeginRequest by the Event AuthenticateRequest
// Event is used to attach Authentication related operations to it
protected void Application_AuthenticateRequest() {
Debug.WriteLine("authentication in process");
}
// Output:
// begin
// authentication in process
通常,一个接一个地调用的事件处理程序的执行会重叠。这些没有。为什么?