Skip to content

Latest commit

 

History

History
73 lines (48 loc) · 5.76 KB

File metadata and controls

73 lines (48 loc) · 5.76 KB
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

IHttpCompletionInfo::GetCompletionStatus Method

Returns the status of an asynchronous operation.

Syntax

virtual HRESULT GetCompletionStatus(  
   VOID  
) const = 0;  

Parameters

This method takes no parameters.

Return Value

An HRESULT that contains the status for the asynchronous operation.

Remarks

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.

Example

The following code example demonstrates how to create an HTTP module that performs the following tasks:

  1. The module registers for the RQ_BEGIN_REQUEST and RQ_MAP_REQUEST_HANDLER notifications.

  2. The module creates a CHttpModule class that contains OnBeginRequest, OnMapRequestHandler, and OnAsyncCompletion methods.

  3. When a Web client requests a URL, IIS calls the module's OnBeginRequest method. This method performs the following tasks:

    1. Clears the existing response buffer and sets the MIME type for the response.

    2. Creates an example string and returns that to the Web client asynchronously.

    3. 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.

  4. IIS then calls the module's OnMapRequestHandler method. This method performs the following tasks:

    1. Flushes the current response buffer to the Web client.

    2. Tests for an error or asynchronous completion. If asynchronous completion is pending, the module returns a pending notification status to the pipeline.

  5. If asynchronous completion is required, IIS calls the module's OnAsyncCompletion method. This method performs the following tasks:

    1. Tests for a valid IHttpCompletionInfo interface. If a valid IHttpCompletionInfo interface was passed, the method calls the GetCompletionBytes and GetCompletionStatus methods, respectively, to retrieve the completed bytes and return the status for the asynchronous operation.

    2. Creates strings that contain the completion information and writes the information as an event to the application log of the Event Viewer.

  6. The module removes the CHttpModule class 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.

Requirements

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

See Also

IHttpCompletionInfo Interface
IHttpCompletionInfo::GetCompletionBytes Method