随笔 - 60  文章 - 5  trackbacks - 0
<2010年1月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456

常用链接

留言簿(2)

随笔分类(42)

随笔档案(60)

文章档案(2)

我收藏的博客

搜索

  •  

最新评论

阅读排行榜

评论排行榜

source:http://msdn.microsoft.com/en-us/library/ms524352.aspx
For an ISAPI extension to be used by IIS, it must provide a standard interface. To provide a standard interface, each ISAPI extension DLL must implement and export two primary functions, GetExtensionVersion and HttpExtensionProc. A third function, TerminateExtension, is optional and is commonly used by extensions to perform cleanup operations.

Initialization Using GetExtensionVersion
Initialization is handled by the entry-point function GetExtensionVersion. This function's role is to perform all initialization, including the creation of worker threads, synchronization objects, and database connections, and to establish the version of ISAPI that was used to build the DLL.

Adding Functionality Using HttpExtensionProc

In general, an extension's functionality is exposed through the HttpExtensionProc entry-point function. This function receives a pointer to an EXTENSION_CONTROL_BLOCK structure, which contains data used for the required processing and is also used by the extension to communicate with IIS.
When HttpExtensionProc in employed, it should first send a response header to the client. The header provides the client with information, such as the content type that is returned. After the header is sent, any other processing can be performed through the various callback functions provided in the EXTENSION_CONTROL_BLOCK.

Termination Using TerminateExtension

When an extension is no longer needed, IIS removes it from memory. If the extension provides the TerminateExtension function, IIS calls it before removing the extension. Use of TerminateExtension is recommended to close down any threads that an extension initialized during processing.

After IIS finishes processing a request for an ISAPI extension, the connection can either be closed or kept open. A request can specify that the connection remain open by specifying the Connection: Keep-Alive header. If an ISAPI extension is designed to support Keep-Alive requests, this should be indicated to the client by calling the HSE_REQ_SEND_RESPONSE_HEADER server support function. The specified response header should contain Connection: Keep-Alive.

posted on 2010-01-12 09:15 黄剑父 阅读(257) 评论(0)  编辑 收藏 引用 所属分类: C/C++

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理