How can I force IIS 7 to flush output?

纵然是瞬间 提交于 2020-01-14 09:46:07

问题


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?


回答1:


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.




回答2:


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.




回答3:


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".



来源:https://stackoverflow.com/questions/687133/how-can-i-force-iis-7-to-flush-output

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!