Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio .NET
Visual C++
ATL Server
 Sequence of Events
This page is specific to
Microsoft Visual Studio 2003/.NET Framework 1.1

Other versions are also available for the following:
Visual C++ Concepts: Adding Functionality
Sequence of Events

This topic provides the typical sequence of events in the life of an HTTP request handled by an ATL Server Web application. For a simplified diagram of these events, see SRF Request Architecture.

Typical Sequence of Events

Client

  • The client sends an HTTP request to the Web server.

IIS

  • IIS looks at the requested URL.
  • IIS checks the application mappings for the virtual directory specified in the URL.
  • IIS uses ISAPI to pass the request to the ISAPI extension DLL associated with the requested resource.

ISAPI Extension DLL

  • The ISAPI extension queues the request on the DLL's thread pool.
  • A pool thread retrieves the request from the queue in the order in which it was received.
  • The thread calls back into the ISAPI extension's main class.
  • The ISAPI extension impersonates the client making the request.
  • The ISAPI extension determines whether a response for this request is already in the response cache. If so, that response is returned to the client and request processing stops.
  • Otherwise, the ISAPI DLL examines the extension of the requested resource.
  • If the requested resource is a SRF:
    • The ISAPI extension checks the server response file cache. If the file is present and up to date, the request handler used to handle the request is obtained from the cache.
    • Otherwise, the ISAPI extension loads the SRF file and reads the handler tag to locate the request handler that should handle the request. The handler tag includes the location of the Web application DLL and the name of the request handler.
  • If the requested resource is a DLL:
    • The ISAPI extension locates the request handler that should handle the request by examining the URL. The requested DLL is the Web application DLL. The name of the request handler is given by the Handler parameter in the query string.
  • The ISAPI extension determines whether the DLL is in the Web application DLL cache. If it is, the cached DLL is used. Otherwise, the Web application DLL is loaded and added to the cache.
  • The ISAPI extension calls IRequestHandler::GetFlags to get some initialization data from the request handler.

    The implementation of IIsapiExtension made available to the request handler is selected based on the flags returned by this method. If the request handler specifies the appropriate flags, it will use an implementation that puts the response in the response cache.

  • The ISAPI extension calls IRequestHandler::InitializeHandler to initialize the request handler.
  • The ISAPI extension calls IRequestHandler::HandleRequest to pass the request to the request handler for processing.

Web Application DLL

  • If the requested resource is a SRF, the request handler calls in to the ISAPI extension's SRF cache to see if the SRF has already been parsed.
  • If the response file has not already been parsed, the file is parsed, references to replacement methods are resolved, included handlers and subhandlers are loaded, and the parsed file is added to the cache.

    During this process, further request handlers, SRFs, and Web application DLLs may be loaded, initialized, and stored in the ISAPI extension's caches.

  • When the parsed version of the server response file has been obtained, the file is rendered. The static portions of the file are written to the response stream, and dynamic portions are generated by calling into the replacement methods and by following the control structures in the file.

ISAPI Extension DLL

  • When the response is complete or the buffer is full, the ISAPI extension passes the response to IIS.

IIS

  • IIS passes the response back to the client.

Client

  • The client receives the response.

See Also

ATL Server | ATL Server Reference | ATL Server Samples | SRF Request Architecture

© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker