PRB: Server Side Include #exec Directive and Console Handle Problems (226518)



The information in this article applies to:

  • Microsoft Internet Information Server 3.0
  • Microsoft Internet Information Server 4.0
  • Microsoft Internet Information Services 5.0

This article was previously published under Q226518

SYMPTOMS

The Server Side Include (SSI) capability of Internet Information Server (IIS) provides support for the #exec directive to launch applications whose output will be included in the SSI file's output. However, there may be issues with how the stdio handles work for certain applications. For instance, by default the following line will create the output file c:\out1.txt but it will be empty.
<!-- #exec cmd="cmd /c ping localhost > c:\out1.txt" -->
				

CAUSE

The same infrastructure that launches CGI applications for IIS is used to launch commands for the #exec directive in SSI scripts. By default these processes are not launched with a console. Therefore there are issues that arise when console handles are assumed to exist as in the case above.

RESOLUTION

Here are two possible work arounds:
  1. If you have access to the source code for the application you are launching, you can have it call AllocConsole() to ensure that the console stdio handles are available.
  2. You can configure IIS to create a new console for all processes launched by the CGI infrastructure by setting the CreateCGIWithNewConsole property in the metabase to True.

STATUS

This behavior is by design.

REFERENCES

For additional information about configuring IIS to run CGI applications in a new console, please see the following article in the Microsoft Knowledge Base:

190002 CGI and Perl Applications Do Not Run in a New Console


For additional information about problems that can arise from not having a console allocated, please see the following article in the Microsoft Knowledge Base:

194948 HOWTO: Create a Child Console Process from a CGI Process


Modification Type:MajorLast Reviewed:6/24/2004
Keywords:kbhttp kbprb KB226518