ISAPI Extension DLL
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

ISAPI Extension DLL

Visual Studio .NET 2003

ATL Server Web applications and services communicate with Internet Information Services (IIS) using the Internet Server Application Programming Interface (ISAPI). ATL Server applications use an ISAPI extension DLL to receive requests from and return responses to the client.

Although the ISAPI extension DLL can handle a request entirely by itself, it is usually responsible for passing the request to a request handler implemented in a Web application DLL.

This mechanism requires the ISAPI extension DLL to be registered with IIS as the handler for requests with the .srf and .dll extensions. The registration can be set up by using the Web Deployment property page or by doing it manually.

When the ISAPI extension DLL receives a request for a server response file, it loads the file, reads the handler tag, and uses that information to dispatch the request to the appropriate request handler in the specified Web application DLL.

Note   The ISAPI extension reads only the handler tag in order to pass the request on to the appropriate request handler. It does not read any other tags in the server response file. The request handler is responsible for parsing the server response file. See Sequence of Events for details.

When the ISAPI extension DLL receives a request for a DLL, it checks the query string for the presence of a Handler parameter and uses that information to dispatch the request to the handler in the specified DLL.

The ISAPI extension DLL exposes functionality for use by the Web application DLL through the IHttpServerContext, IIsapiExtension, and IServiceProvider interfaces.

IHttpServerContext provides access to information about the Web server and the particular HTTP request to be handled. This interface is essentially a wrapper for the EXTENSION_CONTROL_BLOCK structure familiar to ISAPI programmers.

IIsapiExtension provides the ability to initialize threads in the thread pool by overriding OnThreadAttach and OnThreadTerminate, add and remove dynamic services by calling AddService and RemoveService, and obtain the worker object for the current thread by calling GetThreadWorker.

The IServiceProvider interface provides access to other services provided by the ISAPI extension.

The Web application DLL exposes its functionality through objects that implement IRequestHandler. In this way, ATL Server provides the ability to create a number of binary components, each of which is responsible for a different part of the application.

A project for an ATL Server ISAPI extension DLL can be generated using the ATL Server Project Wizard. A Web application DLL project may be created at the same time. The DLLs can even be combined using the Generate combined DLL option on the Project Settings page of the ATL Server Project Wizard.

The majority of the functionality of the ISAPI extension DLL is provided by CIsapiExtension. The ATL Server Project Wizard generates a derived class that you can customize. For example, you can add extra features that can be made available to all Web application DLLs that use that ISAPI extension DLL or provide processing that applies to every request or response.

CIsapiExtension provides the following features:

Feature Description
Thread Pool The thread pool is the key to the high performance and scalability of ATL Server Web applications. The ISAPI extension DLL adds each request that it receives to a request queue that is serviced by its own threads. This quickly frees the Web server thread to handle another incoming request and ensures that the application scales as more clients make requests of the server.
Web Application DLL Cache Web application DLLs and pointers to their exported functions are loaded on first use and cached to improve performance.
Server Response File Cache Server response files are parsed and references to request handlers are resolved on first use. The results are cached to improve performance.
Response Cache The responses generated by the Web application can be cached at your discretion. Responses are cached as files that are sent back to the client asynchronously for best performance.

See Also

ATL Server | ATL Server Reference | ATL Server Samples | Web Application DLL

© 2016 Microsoft