IIS 7 and Above
How can I pass command line arguments to my fastcgi process?
Last post Feb 18, 2015 09:43 AM by au.merci
Mar 07, 2013 11:09 PM|roger.austin|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.
Feb 18, 2015 09:43 AM|au.merci|LINK
I am trying to do something very similar, and bump into the exact same problem. Passing arguments to an executable with FastCGI seems to be
Did you ever figured out something else that works?
My problem is actually not about the arguments, but to create a *.php handler from 1 specific website to a unique set of FastCGI settings. More simply put: 1 website can sometimes run long php processes (up to 5 minutes) before displaying a result, and I
want to give that website permission to do so. But I do not want to increase "ActivityTimeout" for
all php processes.
Theoretically I could simply use a unique set of arguments to create a handler for that website, but as you also discovered that results always in a
internal server error