Monday, November 22, 2010

Configuring IronPython CGI on IIS 7

This guide walks you through configuring IronPython CGI on IIS 7.

Install IronPython

First you need to download and install IronPython at http://ironpython.codeplex.com/.
This post uses IronPython 2.7 Beta 1. By default, installer put the files in C:\Program Files (x86)\IronPython 2.7. The installation path might be changed during installation process.

Install CGI support in IIS

By default CGI support is not installed. To turn it on, open Control Panel > Programs and Features > Turn Windows features on and off dialog.

Select Internet Information Services > World Wide Web Services > Application Development Features > CGI module and click OK





Configure Handle Mapping


Open Control Pane > Administrative Tools > Internet Information Services (IIS) Manager

In the Features View, open Handler Mappings, right click to Add Script Map ...

In Request path, put "*.py" as the script files extension, In Executable select "C:\Program Files (x86)\IronPython 2.7\ipy.exe" %s%s - the IronPython installation path and it's parameters.

I actually don't know what such "%s%s" parameters mean, but believe me, you need to keep it as is. It doesn't work without.



Click OK, then you will be prompt to allow this CGI extension - click OK.




Run Python script

Write a simple Python script and place it in the root folder of the web site.



Point your browser to the test script and it should be working.

No comments:

Post a Comment