It is important that your ISAPI extensions support asynchronous operations because that frees server pool threads to complete I/O operations. In addition, the IIS server engine already has built-in support to manage asynchronous I/O operations using the completion ports and server thread pool. ISAPI 1.0 only supported synchronous I/O operations through the ReadClient and WriteClient callback functions.
There are two basic types of async processing.You can implement WriteClient as an async process by setting the dwReserved parameter to HSE_IO_ASYNC. ReadClient and TransmitFile use the ServerSupportFunction to indicate asynchronous processing. For TransmitFile this is accomplished by calling the ServerSupportFunction with the dwHSERequest parameter set to HSE_REQ_TRANSMIT_FILE. For ReadClient the dwHSERequest parameter is set to HSE_REQ_ASYNC_READ_CLIENT.
ISAPI 2.0 and later versions support asynchronous write operations using the existing WriteClient callback function with a special flag that indicates the operation has to be performed asynchronously. In addition, these versions of ISAPI provide a mechanism to request the server transmit a file using the Win32 API TransmitFile. Only one asynchronous I/O operation can be in process at a time. If your ISAPI extension begins an asynchronous I/O operation, you should wait until the operation completes before starting another one.
Note There is exactly one ECB for each ISAPI request. ECBs may be recycled for subsequent requests (only after the completion of the entire request). After calling the ServerSupportFunction with HSE_REQ_DONE_WITH_SESSION the extension should no longer use the ECB for which the call was made.