| title | IHttpServer::DispenseContainer Method |
|---|---|
| description | The IHttpServerDispenseContainer method returns a context container that may be dispensed. This article describes its syntax, remarks, example, and requirements. |
| ms.date | 10/07/2016 |
| ms.assetid | 6ba8224a-bd99-15b8-2025-64ea4b1578b0 |
Returns a context container that may be dispensed.
virtual IDispensedHttpModuleContextContainer* DispenseContainer(
VOID
) = 0; This method takes no parameters.
A pointer to an IDispensedHttpModuleContextContainer.
IHttpServer implementers will typically return a new``IDispensedHttpModuleContextContainer that will call delete on itself when the IDispensedHttpModuleContextContainer::ReleaseContainer method is called.
The following code example demonstrates how to create a global module that listens for GL_CACHE_OPERATION events. This module defines a custom IHttpStoredContext class and then calls the DispenseContainer method with a new pointer to that custom class. The example then writes the custom data to the Event Viewer.
Caution
[!INCLUDEiisver] generates a large number of events in the Event Viewer. To avoid a log overflow error in a production environment, you should generally avoid writing cache information to the event log. For demonstration purposes, this code example writes an entry to the Event Viewer in debug mode only.
[!code-cppIHttpServer#5]
The above code writes new events to the Event Viewer, where the Data box contains strings similar to the following.
DispensedContext::~DispensedContext
DispensedContext::CleanupStoredContext
DispensedContext::Display
DispensedContext::DispensedContext
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.
The RegisterModule calling convention must be stdcall. The best way to guarantee this is to explicitly declare RegisterModule with __stdcall.
| 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 |