Overview of ISAPI Extension

Source: Internet
Author: User

ISAPI extension is a real application running on IIS. It can access all functions provided by IIS. an example of a powerful ISAPI: ASP pages are processed through ISAPI extension. in general, the client can access ISAPI extensions like accessing static HTML files or dynamic ASP files.

ISAPI extension is implemented as DLL files, which are loaded by IIS-controlled processes. Like ASP and HTML pages, IIS uses the virtual path of DLL filesIngThe ISAPI extension on the file system goes to the URL namespace of the IIS service.

Extensions and filters are two types of applications developed through ISAPI. ISAPI extension runs when requested, which is similar to other static HTML pages and dynamic asp pages. because ISAPI applications are compiled code, they process faster than ASP files and other files that call the COM + component.

ISAPI filter and ISAPI extension can only be developed using C or C ++. Visual Studio contains a wizard that can accelerate ISAPI development ).

Application ing-Application Mappings

============================

Application ing (or script ing) is equivalent to File Association on Windows on Web Server. for example, in Windows, when you open a file ending with '.txt ', you will usually be opened by Notepad, because the TXT file is mapped to notepad.exe by Windows.

In IIS, the ASP function is included in ASP. in the ISAPI extension of DLL. any. all files ending with asp are mapped to ASP. dll, ASP. DLL is configured to process files before the client window displays the output.

A client requests the ISAPI Extension in the following way:

http://Server_name/ISAPI_name.dll/Parameter

 

To request an ASP file, the client can request a file similar to http: // Server_name/ASP. dll/File_name.asp URL, because the ASP file is named % windir % \ system32 \ inetsrv \ ASP.. however, to simplify ASP requests, IIS uses a script ing. asp file extension and ASP. DLL Association. when you receive a request similar to http: // Server_name/File_name.asp, IIS runs ASP. DLL isapi extension to process this request. many applications running on IIS are actually ISAPI extension, and they all have their own file extension mappings.

 

ISAPI Extension Processing process-ISAPI Extension Processing Sequence

==============================

  1. If the DLL is not in the memory, IIS loads the DLL to the memory. after the DLL is loaded, Windows automatically calls the DLL entry/exit function (usually the DllMain function ). IIS calls the extension's GetExtensionVersion entry function.

  2. IIS performs a small amount of preprocessing on incoming requests.

  3. IIS creates and fills in the EXTENSION_CONTROL_BLOCK structure to pass the request data and callback function pointer to extension.

  4. IIS calls the HttpExtensionProc function of ISAPI extension and passes a pointer to the EXTENSION_CONTROL_BLOCK structure. This EXTENSION_CONTROL_BLOCK structure is specially created for this request.

  5. ISAPI extension executes some of its designed actions: for example, reading more data from the client (the same as the POST operation), or writing headers and data to the client.

  6. Extension will notify IIS that it has processed the request by leaving the HttpExtensionProc function. for synchronous operations, the function returns HSE_STATUS_SUCCESS; for asynchronous operations, the return code is HSE_STATUS_PENDING. for more information about Asynchronous operations, see Asynchronous I/O Processing

  7. IIS clears the connection used by the request. After cleaning, if the Keep-Alive function is not enabled, the connection is closed.

  8. Once ISAPI extension is no longer needed, IIS will call the TerminateExtension function, provided that extension provides this function. if IIS is configured as the cache ISAPI extensions, TerminateExtension will not be called until the IIS web server is closed or restarted.

ISAPI and CGI

================================

For more information about the comparison between the Internet Server Application Programming Interface (ISAPI) model and the Common Gateway Interface (CGI) model, see the original MSDN document.

 

References:

ISAPI Extension Overview

Http://msdn.microsoft.com/en-us/library/ms525172%28VS.90%29.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.