Represents the method that will handle an asynchronous completion event, which occurs after an asynchronous operation has finished processing.
virtual REQUEST_NOTIFICATION_STATUS OnAsyncCompletion( IN IHttpContext* pHttpContext, IN DWORD dwNotification, IN BOOL fPostNotification, IN OUT IHttpEventProvider* pProvider, IN IHttpCompletionInfo* pCompletionInfo );
[IN] A pointer to an IHttpContext interface.
DWORD value that contains the bitmask for the related notification.
true to indicate that the notification is for a post-event; otherwise,
[IN] A pointer to an IHttpEventProvider interface.
[IN] A pointer to an IHttpCompletionInfo interface.
A REQUEST_NOTIFICATION_STATUS value.
Unlike many of the other CHttpModule methods that are called by registering for specific notifications, IIS will call a module's
OnAsyncCompletion method only when an asynchronous operation has finished. For example, when a request-level module calls the IHttpResponse::WriteEntityChunks method and specifies asynchronous completion, IIS will call the module's
OnAsyncCompletion method when the operation is complete.
When IIS calls the
OnAsyncCompletion method, it will specify the notification type in the
dwNotification parameter, and it will indicate whether the notification was for an event or post-event by using the
fPostNotification parameter. IIS also provides an
IHttpCompletionInfo interface that is pointed to by the
pCompletionInfo parameter. You can use this interface to retrieve additional information about the asynchronous completion.
The following code example demonstrates how to create an HTTP module that performs the following tasks:
When a Web client requests a URL, IIS calls the module's
OnBeginRequestmethod. This method performs the following tasks:
Clears the existing response buffer and sets the MIME type for the response.
Creates an example string and returns that to the Web client asynchronously.
Tests for an error or asynchronous completion. If asynchronous completion is pending, the module returns a pending notification status to the integrated request-processing pipeline.
IIS calls the module's
OnMapRequestHandlermethod. This method performs the following tasks:
Flushes the current response buffer to the Web client.
Tests for an error or asynchronous completion. If asynchronous completion is pending, the module returns a pending notification status to the pipeline.
If asynchronous completion is required, IIS calls the module's
OnAsyncCompletionmethod. This method performs the following tasks:
Tests for a valid
IHttpCompletionInfointerface. If a valid
IHttpCompletionInfointerface was passed, the method calls the GetCompletionBytes and GetCompletionStatus methods, respectively, to retrieve the completed bytes and return the status for the asynchronous operation.
Creates strings that contain the completion information and writes the information as an event to the application log of the Event Viewer.
The module removes the
CHttpModuleclass from memory and then exits.
Your module must export the RegisterModule function. You can export this function by creating a module definition (.def) file for your project, or you can compile the module by using the
/EXPORT:RegisterModule switch. For more information, see Walkthrough: Creating a Request-Level HTTP Module By Using Native Code.
You can optionally compile the code by using the
__stdcall (/Gz) calling convention instead of explicitly declaring the calling convention for each function.
|Client||- IIS 7.0 on Windows Vista
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
|Server||- IIS 7.0 on Windows Server 2008
- IIS 7.5 on Windows Server 2008 R2
- IIS 8.0 on Windows Server 2012
- IIS 8.5 on Windows Server 2012 R2
- IIS 10.0 on Windows Server 2016
|Product||- IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
- IIS Express 7.5, IIS Express 8.0, IIS Express 10.0