HOWTO: Configure Web Service Extensions for CGI Application Mappings on IIS6 (Perl, Python, PHP, etc)

I got the following question about a month ago concerning CGI application map (scriptmap) configuration on IIS6.


Hi David,

I'm having some issues configuring python CGI scripting for IIS 6. I was wondering if you have a canned response or web link giving detail to configuring Python on IIS 6.

If not, I need some help to configure IIS properly.

1. I can add python.exe as a WSE but I cannot get it to be a recognized ext. type. So you have to enable all unknown cgi WSE's.
2. I don't know what settings from IIS 5.0 still apply to IIS 6.0 for python cgi's
3. Do you have a customized iisext.vbs(including parameters) script that successfully configures IIS 6.0 WSE's for python?
4. Are there any incompatibility issues that simply can't be resolved?


  1. Not true. You just do not have the correct Web Service Extension. You should never need to "enable all unknown CGI".
  2. Configuring a scriptmap is exactly the same on IIS6 as on previous versions of IIS. The only additional thing on IIS6 in this area is Web Service Extension, which controls whether the Script Engine can execute or not.
  3. A subtle detail of configuring Web Service Extension for CGI EXE is that you must configure the EXACT same string in BOTH the Web Service Extension and the Script Engine text boxes. In other words, suppose your Application Mapping is -- .py to "C:\Program Files\Python\Python.exe" %s -- you must also give that exact same string to Web Service Extension.

    The short answer for this strange requirement is security. See the following thread for details . An unfortunate side-effect, of course, is that the WSE UI is all but useless for configuring this sort of value since it rejects parameters beyond the first quoted string.

  4. Honestly, this is a question best asked of Python support groups. I do not expect any compatibility issues other than with the security lockdown on Windows Server 2003. In particular, CMD.EXE is no longer accessible to web-authenticated users by default, so many Shell/System calls (like in PHP, Perl, ASP, etc) all fail with access denied.

In general, you have the following choices to configure Web Service Extensions. Now, you need to be aware that with each configuration choice, you are using a different sort of namespace and slightly different encoding/syntax rules. This is how all systems work no matter the operating system; you just have to learn to live with and adapt to it. Some of the special characters that come into play in this situation are space, quote, and ampersand -- because they are encoded differently in various namespace and have different meanings. For example, spaces are used to delimit parameters on the commandline, yet are mere whitespace to XML that can be normalized away. Quote is used to delimit attribute values in XML but delimit commandline parameters with spaces on the commandline; hence you need to " escape them in XML if you wish to preserve its meaning. Ampersand delimit commandlines and denote parameter entities in XML, so you need to & escape them in XML.

  1. Directly modify metabase.xml with the necessary values. Always works.
  2. Directly use the script-accessible IIS administration API to input the right values. Always works.
  3. Use iisext.vbs with compatible values. Works if you do not try to input values with quotes.
  4. Use UI with compatible values. Works if you do not try to input values with parameters.

Some examples:

  1. .py -> "C:\Program Files\Python\Python.exe" %s
    iisext.vbs /AddFile "C:\Program Files\Python\Python.exe %s" 1 Python 1 Python

  2. .py -> "C:\Program Files\Python\Python.exe" "%s"

    1. iisext.vbs /AddFile "C:\Program Files\Python\Python.exe %s" 1 Python 1 Python

    2. Edit metabase.xml to include:
      C:\Program Files\Python\Python.exe "%s"

Note where you have " and where you do/not have ""s. Remember that editing metabase.xml requires either you either:

  1. Enable Edit While Running
  2. Or you first run NET STOP /y IISADMIN, make your metabase.xml changes, then run NET START W3SVC 


Comments (3)

  1. Ramesh says:

    Hi David,

    When I execute the program  below ,

    cmd="C:Program FilesTecplotTec360 2008bintec360.exe "  


    I got the error

    ‘c:program’ is not recognized as internal or external command, operable program or batch file.

    Could you please tell me what is the issue over here.



  2. Ossowsky says:

    DUDE !!! What the Hell is up !! i need to add you to my topfriend,

  3. freak says:

    And how does the same work for out for IIS 7 ?

Skip to main content