如何在C#web应用程序中运行命令工具exe?

如何在C#web应用程序中运行命令工具exe?,c#,shell,web-applications,command-line-arguments,exe,C#,Shell,Web Applications,Command Line Arguments,Exe,我正在使用graphicmagic exe使用命令提示符执行命令。我已将graphicmagic exe添加到我的应用程序根文件夹中。我想执行这个exe并通过c#传递参数。如何做到这一点?我尝试了以下代码: 方法:1 Process proc = new Process { StartInfo = new ProcessStartInfo { FileName = AppDomain.CurrentDomain.BaseDirectory + "\\gm1.3.

我正在使用graphicmagic exe使用命令提示符执行命令。我已将graphicmagic exe添加到我的应用程序根文件夹中。我想执行这个exe并通过c#传递参数。如何做到这一点?我尝试了以下代码:

方法:1

Process proc = new Process
{
    StartInfo = new ProcessStartInfo
    {
         FileName = AppDomain.CurrentDomain.BaseDirectory + "\\gm1.3.5\\gm",
         Arguments = "convert -define dpx:colorspace=rgb -define tiff:bits-per-sample=16 'D:\\Image\\FFv1\\dpx1\\1.dpx' 'D:\\Image\\FFv1\\tiff1\\1.tiff'",
         UseShellExecute = false,
         RedirectStandardOutput = true,
         CreateNoWindow = true
    }
}
方法:2

Process proc = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.FileName = @"D:\Executable\Projects\MMF\gm1.3.5\gm";
startInfo.Arguments = "convert -define dpx:colorspace=rgb -define tiff:bits-per-sample=16 \"D:\\Image\\FFv1\\dpx1\\1.dpx\" \"D:\\Image\\FFv1\\tiff1\\1.tiff\"";
proc.StartInfo = startInfo;
proc.Start();

但这两种方法都不起作用。请建议执行exe文件和传递命令的方法。

这应该是权限问题。
尝试将应用程序池中的标识调整为LocalSystem。

此标识工作正常:

using System.Diagnostics;

Process p = new Process();
p.StartInfo.FileName = @"D:\Executable\Projects\MMF\gm1.3.5\gm.exe";
p.StartInfo.Arguments = "convert -define dpx:colorspace=rgb -define tiff:bits-per-sample=16 \"C:\\Documents and Settings\\software\\Desktop\\DPX_Test\\3.dpx\" \"C:\\TEMP_21May2015103216\\3.tiff\"";
p.Start();                
p.WaitForExit();

它们以什么方式不起作用?(请记住,web应用程序是以有限的权限和访问权限运行的。)实际上,我正在使用shell方法在vb.net中使用此exe转换图像,它正在转换。当我尝试使用C#转换时,它没有转换。是否引发异常?你能从这个过程中得到任何输出吗?没有例外。但是图像没有在路径中转换。如何在c#中调用exe并传递片段?像vb.net中的shell一样