Some of the information here may be outdated, please check the book instead

This example shows how to integrate web2py and IIS using the commercial version of the Helicon ISAP_Rewrite 3 module.

Unfortunately the freely available Lite-version does not support the needed proxy features (believe me, I tried this, the documentation is correct). For me, the price for this tool is acceptable; it saves a lot of time.


  • IIS is installed and running
  • Any edition of MS SQL Server is installed, running and reachable through the web server
  • Python is installed and running
  • web2py is installed and running


  • Install Helicon ISAP_Rewrite 3
  • Configure ISAP_Rewrite 3
  • Install web2py as a service
  • Configure MSSQL Server access

I assume, that you are logged into your windows server with an administrator account.

Install Helicon ISAP_Rewrite 3

Download the full version of Helicon ISAP_Rewrite 3, simply start the program and follow the installations instructions.


Configure ISAP_Rewrite 3

The ISAPRewrite module uses text-based configuration files like the apache web server. These file can be edited manually or with a little GUI-program, which is located under Programs > Helicon > ISAPIRewrite3. You can manually start this tool with:

=> "%ProgramFiles%\Helicon\ISAPI_Rewrite3\Helicon Manager.exe"

Choose the designated Website, click the edit button and paste the following text snippet into the editor. After closing the window and saving the file, the configuration is done.

RewriteEngine on RewriteBase / RewriteRule (.+)$1 [NC,P]

Every Request to the IIS website is routed to the locally running web2py web server. To test this, just start web2py manually in interactive mode, open a browser and go to "http://<MyIISWebSiteName>/examples". This should show you the web2py-examples web page.

Install web2py as a service

This is perfectly described in an already existing AlterEgo entry:


Configure MSSQL server access

For accessing a MSSQL server through python, download and install pymssql:


After successfully installing the module and restarting web2py, this driver is available.

In change the connection string as needed:

db = SQLDB('mssql://<username>:<password>@<server>/<database>')

For example:

  1. db = SQLDB('mssql://username:password@localhost/web2py')
  2. db = SQLDB('mssql://username:password@(local)\SQLEXPRESS/web2py')

The second example is for accessing a named instance of a MSSQL server.

© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by web2py - design derived from a theme by the earlybird
The content of this book is released under the Artistic License 2.0 - Modified content cannot be reproduced.