Solved

Disable output buffering in IIS8 for CGI exe file output

Posted on 2016-08-20
5
108 Views
Last Modified: 2016-08-22
I've got an EXE program that is executed by IIS8 (on Win2012 server) using CGI, to generate an html page.
Now I want this output not to be buffered by IIS, as it takes some time to generate the output and the end user should need to wait for the first lines to appear

The application flushes output and al, but IIS keeps it in its output buffer until the EXE file has finished running.

How do I disable this output buffering that IIS performs? Either using IIS Manager, or using web.config - or the registry, maybe?
Any ideas?
0
Comment
Question by:stefanlennerbrant
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 28

Expert Comment

by:Dan McFadden
ID: 41764940
You should look into the "Caching" controls available in IIS.

Reference Link:  https://www.iis.net/configreference/system.webserver/caching

I would recommend trying to control the output buffering (caching) at the user mode level.

The following links describe the config process in IIS7, which is valid for IIS8+ since the the element has not changed since its introduction in IIS7.  Second link is a nicely detailed article.

Links:
- http://www.iis.net/learn/manage/managing-performance-settings/configure-iis-7-output-caching
- https://codewala.net/2014/07/01/leverage-output-caching-with-iis7-x-and-iis8-x/ 

Dan
0
 

Author Comment

by:stefanlennerbrant
ID: 41764968
Thanks, but caching is not the issue here, I think.

Caching means that (selected) dynamic output is not re-generated by the applications (the CGI exe-file) when the user requests it - instead the result is taken from the IIS cache.
This is of course impossible to have for realtime database applications, so I disabled caching at the very beginning -- with the web.config "<system.webServer>" parameter "<caching enabled="false" enableKernelCache="false" />

Buffering, instead, is the function that output that is generated by the CGI exe-file is not immediately output to the user client as it is generated, but IIS "holds it" temporarily (just for a second, that is), and then sends all of the data to the end user when the application finishes running.

And it is this function that I'd like to disable.

/Stefan
0
 
LVL 28

Accepted Solution

by:
Dan McFadden earned 500 total points
ID: 41765148
I understand the difference between caching and buffering... you had not stated that you disabled caching in the OP.

I would try tweaking the CGi/FactCGI definition at the site level.  You can define an attribute on the ADD element that describes the CGI-exe module, called "responseBufferLimit" and seting it to zero should kill the buffering.

Something like this"

<add name="CGI-exe" path="your-file.exe" verb="*" modules="CgiModule" resourceType="File" requireAccess="Execute" allowPathInfo="true" responseBufferLimit="1024" />

Reference Link:   https://forums.iis.net/t/1078563.aspx

Dan
0
 

Author Closing Comment

by:stefanlennerbrant
ID: 41765163
Thanks

Actually I just found the solution myself  just now, a little different but the same principle.

I used IIS manager to open the Configuration for the virtual directory containing my EXE programs, selected the section "system.webServer/handlers" and then opened and edited the "ApplicationHost.config C2/c2" settings
There, I could set responseBufferLimit=0 for CgiModule

I suppose (?) that the effect is the same with your suggestion?
My solution proved to work as well.

Thanks,
/Stefan
0
 
LVL 28

Expert Comment

by:Dan McFadden
ID: 41765169
Same solution, but I would recommend that this be done done at the site (local) scope level.

Reason being is that this could be a performance issue with other types of FastCGI/CGI applications that are now or in the future, running on this server.

You tweak is at the server scope level.  If you have any other sites running on this IIS server, it will inherit the settings from the ApplicationHost.config file.

Dan
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
A phishing scam that claims a recipient’s credit card details have been “suspended” is the latest trend in spoof emails.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question