How to set access permission to call command prompt by specified URL in Windows Server 2012? RRS feed

  • Question

  • My aim is to execute a command line app being called from a web service, code is as follows

    public string CreateTumbnail(string file_name)
                    StringBuilder command = new StringBuilder();
                    System.Diagnostics.Process process = new System.Diagnostics.Process();
                    System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
                    startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                    startInfo.FileName = "cmd.exe";
                    command.AppendFormat(@"ffmpeg -i ""D:\{0}.flv"" -an -ss 00:00:01 -s 200*98 -vframes 1 -f mjpeg D:\{0}.jpg", file_name);
                    startInfo.Arguments = command.ToString();
                    startInfo.RedirectStandardOutput = true;
                    startInfo.UseShellExecute = false;
                    process.StartInfo = startInfo;
                    string q = "";
                    q += command + "\n\n" + process.StandardOutput.ReadToEnd();
                    return q;
                catch (Exception ex)
                    return ex.Message;

    Even I've created WCF service hosted on Windows service based following this example from MSDN

    But based on my research command prompt is not accessible on HTTP protocol in Windows Server 2012. Now, my question is how we can set permission to access and execute command prompt for following specified URL?

    Protocol: http

    Host: localhost

    Port: 8085

    Final Path: http://localhost:8085/


    Thanks for your help


    Friday, December 6, 2013 6:45 AM


  • Hi,

    In my mind, I think myabe you should write a console application that calls the WCF service, and then call the console application from the command line.

    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, December 12, 2013 8:59 AM