| title | IHttpCompletionInfo::GetCompletionStatus Method |
|---|---|
| description | This article has information about syntax, return value, and requirements for the IHttpCompletionInfo::GetCompletionStatus method. |
| ms.date | 10/07/2016 |
| ms.assetid | d6f1d9fb-5344-13b2-5ffe-eeba3a6a1fd8 |
Returns the status of an asynchronous operation.
virtual HRESULT GetCompletionStatus(
VOID
) const = 0; This method takes no parameters.
An HRESULT that contains the status for the asynchronous operation.
The GetCompletionStatus method allows you to retrieve the status of an asynchronous operation. When you request an asynchronous operation, [!INCLUDEiisver] creates an IHttpCompletionInfo interface and passes that interface to your module's CHttpModule::OnAsyncCompletion method to process the asynchronous operation. You can then use the GetCompletionStatus method to retrieve the status for the asynchronous operation.
The following code example demonstrates how to create an HTTP module that performs the following tasks:
-
The module registers for the RQ_BEGIN_REQUEST and RQ_MAP_REQUEST_HANDLER notifications.
-
The module creates a CHttpModule class that contains OnBeginRequest, OnMapRequestHandler, and
OnAsyncCompletionmethods. -
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 then 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 validIHttpCompletionInfointerface was passed, the method calls the GetCompletionBytes andGetCompletionStatusmethods, 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.
[!code-cppIHttpCompletionInfoIHttpCompletionInfo#1]
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.
| Type | Description |
|---|---|
| Client | - IIS 7.0 on [!INCLUDEwinvista] - IIS 7.5 on Windows 7 - IIS 8.0 on Windows 8 - IIS 10.0 on Windows 10 |
| Server | - IIS 7.0 on [!INCLUDEwinsrv2008] - 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 - [!INCLUDEiisexp75], [!INCLUDEiisexp80], [!INCLUDEiisexp100] |
| Header | Httpserv.h |
IHttpCompletionInfo Interface
IHttpCompletionInfo::GetCompletionBytes Method