简体   繁体   中英

How can I force IIS 7 to flush output?

In IIS 6, using Perl, I was able to send a stream of output to the client rather than buffering the entire thing and dumping it out at all once. This allowed such things as progress bars and such to be used.

How can I accomplish the same thing in IIS 7?

Under IIS 7, once you have created the Perl Script script mapping, you can add an attribute that will fix this.

You modify the %windir%\\system32\\inetsrv\\config\\applicationHost.control file and find the script mapping by name (in my case, Perl-Script). Then add the responseBufferLimit attribute into the XML, for example:

<add name="Perl-Script" path="*.pl" blah blah blah responseBufferLimit="0" />

This causes IIS to run as it did in IIS 6, with buffering off.

You can customize the web application's web.config to set responseBufferLimit="0" instead of changing global settings. Example web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="Perl CGI for .pl (custom)" path="*.pl" verb="GET,HEAD,POST" modules="CgiModule" scriptProcessor="C:\Perl64\bin\perl.exe &quot;%s&quot; %s" resourceType="File" requireAccess="Script" responseBufferLimit="0" />
        </handlers>
    </system.webServer>
    <system.web>
        <identity impersonate="false" />
    </system.web>
</configuration>

Place this file in the web root directory. It will override server settings for *.pl .

The ONLY thing that worked for my in IIS 7.5 (Windows 7) was the following command, run from CMD:

appcmd.exe set config /section:handlers "/[name='PHP_via_FastCGI'].ResponseBufferLimit:0"

NOTE: You must replace PHP_via_FastCGI with the name of your PHP handler in "Handler Mappings".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM