IIS 7 & IIS 8
How can I pass command line arguments to my fastcgi process?
Last post Mar 08, 2013 03:09 AM by roger.austin
Mar 08, 2013 03:09 AM|LINK
I have created a Visual C++ app called fastcgi.exe and I want to use this with the IIS 7.5.7600.16385 FastCgiModule.
If I use IIS Manager to create a handler mapping using FastCgiModule, specifying this executable, then IIS Manager also automatically creates a corresponding entry in FastCGI settings. All I have to do then is set the protocol for the latter to Tcp and everything
works. My fastcgi.exe receives requests and sends responses that I see in my Web browser.
Now I want to pass an argument to fastcgi.exe on its command line (because my exe is actually a script processor and the fastcgi processing is done by this script - currently the script path is hard-coded but I want this choice of script to be part of the
configuration of my IIS website). The FastCGI settings entry has a property for command line arguments, but I cannot change it once the entry has been created - it appears to be part of the key. I have tried various approaches:
1. If I add command line arguments to the path I select when creating a handler mapping, the FastCGI setting entry created by IIS Manager includes these in the path, not in the arguments property. In the browser, I see
Moreover, I cannot then edit this FastCGI setting entry in IIS Manager because it complains it is not a .exe.
2. If I create the handler specifying just the executable, then manually create a FastCGI settings entry with the same executable, but adding an argument (which you can only do at the time the entry is created) then in the browser I see:
This is the point I made above about the arguments perhaps being part of the key used to match a handler to a fastCGI application.
3. If I set up a working configuration using just the exe paths, then use appcmd to set the argument property of the entry in the fastCGI section (not possible using IIS Manager as noted above) then I get the same error as in 2 above.
I will probably instead try to use an environment variable to pass the script to my fastcgi.exe, but nevertheless it is frustrating that there is a way to specify a command line argument but that this does not actually seem to be workable in any configuration
I have tried.