Server side command line

I was wondering if it is possible to run the command line function on the server through the mvc web application.

To clarify itself: The
  user uploads a couple of files to the server through the mvc web application. Then he presses the button and the server launches the command line application.

Is it possible?

Thank you in advance

Note. The server is Windows 2008.

+5
source share
1 answer

Yes. Assuming you have a command line application (i.e. you have a console application) that does not require user interaction, you can try the following in your controller method.

Process serverSideProcess = new Process();
serverSideProcess.StartInfo.FileName = @"C:\pathToTheExe";
serverSideProcess.StartInfo.Arguments = "arg1 arg2 arg3"; 
serverSideProcess.EnableRaisingEvents = true;
serverSideProcess.StartInfo.UseShellExecute = true;
serverSideProcess.Start();

, Identity , . AppPool. , . - AppPool , .

+8

All Articles