How to run CGI applications on IIS7

While trying out the /n software IP*Works! 3-D Secure MPI C++ Edition (for implementing Verified By Visa, MasterCard SecureCode, or JCB J/Secure) I needed to figure out how to run a CGI application in IIS7.  I had a compiled c++ exe (3dsecure.exe) that would handle my 3d secure authentication, but what was the next step?  Here's how to do it:

First, go to the Internet Information Services (IIS) Manager snap-in.  Click on the server in the Connections list, and then click on "ISAPI and CGI Restrictions" under the IIS features view.  Here you'll want to specify the path to a specific cgi application that you want to allow.  Optionally, here you could also allow any cgi app to run, but that's not recommended.

Next, go back to the server (or a specific website) and click on Handler Mappings.  You may already have a "CGI-exe" handler (for *.exe) that is disabled by default.  Enable this, or add a new one (Request path = *.exe, Module = CgiModule, Name = whatever you like).  In the handler permissions you'll need to have "Execute" checked.

Print | posted on Thursday, December 13, 2007 1:58 PM

Feedback

# re: How to run CGI applications on IIS7

Left by Matt at 1/20/2008 9:30 PM
Gravatar Just thought I'd let you know that you just ended about 6 hours of frustration on my part. What a huge pain in the ass. Of course, now the exe is unable to write to a log file on my machine, but hopefully I'm 1 step closer.

Thanks for cataloging this.

# re: How to run CGI applications on IIS7

Left by David at 7/14/2008 7:29 PM
Gravatar
We also just wrote a tutorial about geting CGI's to work with IIS7 (and previous IIS releases) which might help some people.
http://www.wrensoft.com/zoom/support/faq_cgi_iis.html

# re: How to run CGI applications on IIS7

Left by Allan at 9/27/2008 6:23 AM
Gravatar Thank you very much!

# re: How to run CGI applications on IIS7

Left by Harald Mais at 2/5/2009 6:03 AM
Gravatar We try to run our cgi-app under IIS 7.0 and Vista.
In your tutorial you explained what to do under
IIS 7.0 (Windows Server 2008).
We configured "ISAPI and CGI Restrictions" and "Handler Mappings" as explained, but we get an Error "502.2 Bad Gateway".
Under Vista we can't find the "Server Manager".
(perhaps we ar blind)
Is there no "Server Manager" or can you give as a hint what to do instead?
Thanks for an answer.

Thanks for an answer.

# re: How to run CGI applications on IIS7

Left by mofun.cc at 3/19/2009 8:21 AM
Gravatar Thank you!
I got the same problem.

# re: How to run CGI applications on IIS7

Left by Marco at 5/14/2009 3:52 AM
Gravatar Same here!

We have converted the directory where the .exe is into 'application'. We entered Module Mapping for this directory to the .exe-file, with executable rights. And we checked ISAPI and CGI restrictions.

Still when calling the html-page that launches the .exe:

"HTTP Error 502.2 - Bad Gateway
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "".

Anyone out there with suggestions?

# re: How to run CGI applications on IIS7

Left by the birdie at 7/3/2009 5:22 AM
Gravatar Hi,
Anyone know how to run all cgi's on a given folder without specifiying each file? It seems kinda of a pain in the butt to do this. Would I have to make a dll file that does this? any help? heh

thanks
-- the birdie

# re: How to run CGI applications on IIS7

Left by Caleb at 9/10/2009 1:02 AM
Gravatar Hi,
I have done all of the above and got the same meaage:
"HTTP Error 502.2 - Bad Gateway
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "".
Does anybody have a resolution?
Thanks ....

Your comment:





 
 

Copyright © Lance Robinson

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski