| title | IHttpServer::AssociateWithThreadPool Method |
|---|---|
| description | Learn how the AssociateWithThreadPool method associates an asynchronous completion operation with the thread pool. |
| ms.date | 10/07/2016 |
| ms.assetid | b215486a-b494-4873-044a-9d105ce7744e |
Associates an asynchronous completion operation with the thread pool.
virtual HRESULT AssociateWithThreadPool(
IN HANDLE hHandle,
IN LPOVERLAPPED_COMPLETION_ROUTINE completionRoutine
) = 0; hHandle
[IN] A HANDLE for the asynchronous operation.
completionRoutine
[IN] An LPOVERLAPPED_COMPLETION_ROUTINE function pointer.
An HRESULT. Possible values include, but are not limited to, those in the following table.
| Value | Description |
|---|---|
| S_OK | Indicates that the operation was successful. |
Developers can use the AssociateWithThreadPool method to associate a handle for an asynchronous input/output operation with the IIS thread pool. Because the asynchronous operation associated with that handle will complete within the IIS thread pool, the AssociateWithThreadPool method allows you to perform a series of asynchronous operations without maintaining your own thread pool.
The following code example demonstrates how to use the AssociateWithThreadPool method to create an HTTP module that creates a condition that requires an asynchronous input/output operation and associates the asynchronous completion routine with the IIS thread pool.
[!code-cppIHttpServerAssociateWithThreadPool#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 |