Forum Moderators: open

Message Too Old, No Replies

Running a CLI Application via the web

         

mqcarpenter

5:28 pm on Feb 9, 2009 (gmt 0)

10+ Year Member



I have an application that I need to run from my web site. It is a PDF processing tool that is already set up and called from a PHP script.

In IIS, I have tried giving the visitor permissions to run the application by creating a separate application pool, creating a web service extension, etc, but it will not run.

The only way it will run is if I give the anonymous user temporary access to execute CMD.EXE in system32. Obviously I do not want to do this but I can not find a way for it to run otherwise.

I am using IIS 6.0 and know there are security restrictions to this sort of thing. Is there a secure way to give the visitor access to run a CLI based application?

Below is a sample of the PHP script:


Built the Executable statement $LOCALAPPLICATION_Appl = "$LOCALAPPLICATION_ -r $LOCALAPPLICATION_RegNum";
$LOCALAPPLICATION_Parms = "-s -p -l $LogFile -o $OutPdfFile $InPdfFile $InFdfFile";
$LOCALAPPLICATION_Cmd = $LOCALAPPLICATION_Appl . $LOCALAPPLICATION_Parms;

#Execute the LOCALAPPLICATION_ command line and get the return code.
$Return = system($LOCALAPPLICATION_Cmd);

mqcarpenter

8:02 pm on Feb 9, 2009 (gmt 0)

10+ Year Member



After reading this KB: [support.microsoft.com...]

and some suggestions in other dev circles, it looks like giving R ACL access to IUSR_LOCAL is normal to run CLI commands. Is this accurate? I will look at other resources but want to be sure.

mrMister

10:54 am on Feb 10, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't understand why you want to run it as a CGI application when in the past you've given an example with PHP. That makes no sense to me.

If you want to do the same thing as with PHP but on IIS, you need to use ASP.Net. Have a look at the Process class documentation for details on how to do it.