日期:2014-05-20  浏览次数:20695 次

System.Diagnostics.Process
public void ConvertToSWF(string oldFile, string swfFile)
  {
  System.Diagnostics.Process pc = new System.Diagnostics.Process();
  pc.StartInfo.FileName = @"F:\flashPaper\FlashPaper2.2\FlashPrinter.exe";
  pc.StartInfo.Arguments = string.Format("{0} -o {1}", oldFile, swfFile);
  pc.StartInfo.CreateNoWindow = true;
  pc.StartInfo.UseShellExecute = false;
  pc.StartInfo.RedirectStandardInput = false;
  pc.StartInfo.RedirectStandardOutput = false;
  pc.StartInfo.RedirectStandardError = true;
  pc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
  pc.Start();
  pc.WaitForExit();
  pc.Close();
  pc.Dispose();
  }
为什么在vs 2008里可以使用,到2010里就不可以了呢。。 
BasePriority = “pc.BasePriority”引发了“System.InvalidOperationException”
在线等啊。

------解决方案--------------------
代码没问题

你是webform还是winform?

webform你需要放到网站目录下,而不是直接写
pc.StartInfo.FileName = @"F:\flashPaper\FlashPaper2.2\FlashPrinter.exe";

应该写
pc.StartInfo.FileName = Server.MapPath("~/FlashPaper2.2/FlashPrinter.exe");

oldFile, swfFile
也是一样
------解决方案--------------------
你是什么类型的工程?
Web还是Winform??
------解决方案--------------------
iis运行的匿名帐户默认是没有执行exe权限的。你需要在应用程序池里面的标识中选择本地系统或者指定管理员帐户,或者在web.confg里面进行模拟帐户
------解决方案--------------------
发布到IIS中就不好使了
1,没有权限
2,没有放到iis目录下,不要访问目录外的文件和目录