CLStencil Sample: Runs Request Handler DLLs or SRF Files from the Command Line

Demonstrates how to provide custom implementations of IHttpServerContext and IIsapiExtension to create a command-line tool for generating responses from SRF files and Web application DLLs without requiring IIS.

Note that CLStencil only provides a partial implementation of IHttpServerContext and CIsapiExtension. Items that are specific to a Web server, such as IHttpServerContext::MapUrlToPathEx, are not supported.

CLStencil tries to locate server variables in the current environment, so if the request handler needs a specific server variable, be sure to set it in the environment before running the application. For example, you can run the following command at a command prompt to make the SERVER_PROTOCOL variable available to CLStencil and the request handlers it loads:

SET SERVER_PROTOCOL=HTTP/1.1.

Security Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices.

Building and Running the Sample

It is not necessary to build this sample to see the tool in action. The executable file (clstencil.exe) is shipped with Visual Studio in the Vc7\bin directory. Instructions for use can be found below:

To use CLStencil

  • Run clstencil.exe from the command line using the following command:

    clstencil i SrfFile o OutputFile e ErrorFile

    Where:

    SrfFile   The name of the SRF file to be processed.

    OutputFile   The name of the file to which the generated content will be written.

    ErrorFile   The name of the file to which warning and error messages will be written.

    Run clstencil.exe with no arguments for more information on its command line arguments.

Demonstrates

IHttpServerContext | IIsapiExtension | AtlServerRequest