Iis – Running Web.py as an IIS CGI Script

cgiiisisapipython

I recently wrote a web.py-based stand alone web service. Due to unforeseen circumstances, the service has to run through IIS. I've heard that it's possible to run web.py as a CGI in IIS, but I'm having trouble setting it up. I can run Python CGI scripts, but I get internal server errors when I try to run the web.py-based script. The error states:

CGI Error

The specified CGI application misbehaved by not returning a complete set of HTTP headers.

For reference, the script is:

import web
urls = (
   '/(.*)','hello'
)
class hello:
    def GET(self,name):
        i = web.input(times=1)
        if not name: name = 'world'
        for c in xrange(init(i.times)): print 'Hello, '+name+'!'
if __name__=="__main__":
    web.run(urls)
  1. Where are the log files for IIS that would have internal server error information?
  2. Do I have to employ a Rewrite ISAPI filter to use web.py on IIS?
  3. Do I need to employ a WSGI-ISAPI bridge to use web.py on IIS?
  4. Has anyone done this before?

This thread mentions using a hacked version of flup to avoid socket creation, which I've done, but to no avail.

Best Answer

Here is some info: http://support.microsoft.com/kb/145661

Here is a suggestion: http://support.microsoft.com/kb/238788

Here is a bugfix: http://support.microsoft.com/kb/884764

If you are running IIS7, (you didn't really specify), the last one can probably just be ignored