How to enable CGI extension on IIS7 server?

I had to install Mercurial Server on IIS 7 recently. One of the prerequirement is to have Python installing on IIS has a CGI extension.

For this, you need to add an handler on IIS to map .cgi to Python. Unfortunately, this operation is not straight forward. If you try to add the Handlers Mapping for CGI you will get this error message.

Add Script Map error

The specified module required by this handler is not in the modules list. If you are adding a script map handler mapping, the IsapiModule or the CgiModule must be in the modules list.

To fix that, you need to open the Server Manager (%SystemRoot%\system32\CompMgmtLauncher.exe) and go to Roles and Web Server (IIS). From here you may have to wait few minutes and you will be able to add the Cgi extension.

Add Cgi extension to IIS server

Then, the last step is to Install. This also takes few minutes. Once done, restart IIS and you will be able to add the Http Handler for Python (or what ever CGI you need).

If you like my article, think to buy my annual book, professionally edited by a proofreader. directly from me or on Amazon. I also wrote a TypeScript book called Holistic TypeScript

5 thoughts on “How to enable CGI extension on IIS7 server?

  1. Thanks for this post! I know it is such a simple task, but I am buried in all the configurations I have to make to this box. I appreciate you posting this!

  2. Pingback: How to Setup awstats on IIS 7.5 | Coding thoughts and examples

Leave a Reply to RJett Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.