webservice 中怎么调用exe程序并传递命令?
webservice 中怎么调用exe程序并传递命令?我现在有一个控制台应用程序,我想通过webservice调用它,传递一个参数,再得到它返回的一个值,怎么实现? --------------------编程问答-------------------- 可以用Process.Start处理
不过在需要提升Webservice程序的访问权利 --------------------编程问答-------------------- Sample code as below:
ProcessStartInfo startInfo = new ProcessStartInfo("cmd.exe");
startInfo.Arguments = "/C " + e.Command;
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardOutput = true;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
Process p = Process.Start(startInfo);
string output = p.StandardOutput.ReadToEnd();
string error = p.StandardError.ReadToEnd();
p.WaitForExit();
if (output.Length != 0)
shellControl1.WriteText(output);
else if (error.Length != 0)
shellControl1.WriteText(error);
referred from:
http://www.codeproject.com/KB/miscctrl/shellcontrol.aspx
补充:.NET技术 , Web Services