This project has moved. For the latest updates, please go here.

Wrong DOCUMENT_ROOT in wfastcgi 2.0

Sep 11, 2014 at 5:00 AM
Edited Sep 11, 2014 at 5:12 AM
Or at least, wrong physical_path path variable, from which wfastcgi calculates the location of web.config

wfastcgi creates a wrong DOCUMENT_ROOT variable. It will not point to the location of script (as one could think from the code), but rather to 'c:\inetpub\wwwroot'. This is despite me running on an application in a completely different location

You can see this if:
  1. Install a fastcgi as described in many tutorials. Set WSGI_HANDLER to
  2. Use the following short wsgi application in
def app(environ, start_response):
    headers = [(Content-Type', 'text/html'),]
    start_response('200 OK', headers')
    yield '<html><head></head><body><table>'
    for key, value in sorted(environ.items()):
        yield '<tr><td>%s</td><td>%s</td></tr>' % (key, value)
    yield '</table></body></html>'
Browse to the page, and notice that DOCUMENT_ROOT is 'c:\inetpub\wwwroot'. Having a wrong document root cause wfastcgi to ignore the <appSettings> element, and the ability to have a "localized" (that is - unique for application) variables is gone.

This is especially weird, because it seems that is doing the right thing: In line 573 it has:
    physical_path = record.params.get('DOCUMENT_ROOT', path.dirname(__file__))
What is going on? How can I have more than one WSGI_HANDLER in the system (Ideally, set separately per handler, but at least per application)?