进程.Start()在本地运行但不在服务器上运行

时间:2017-05-11 19:10:01

标签: c# adobe iis-6

我有来自How can I send a file document to the printer and have it print?的代码。当我在我的机器上运行它时,它完美无缺。一旦我将它放在VM上进行测试,它就不再打印了。我发现这可能是因为应用程序没有打开Adobe。我已授权访问PDF所在的文件夹,并更改了Adobe中的安全设置。

我的代码:

try
{
  ProcessStartInfo info = new ProcessStartInfo();
  info.Verb = "print";
  info.FileName = @"properFilePath.pdf";
  info.CreateNoWindow = true;
  info.WindowStyle = ProcessWindowStyle.Normal; // so I know Adobe is opening
  TimeSpan tp = new TimeSpan(0, 0, 10); // I thought this did something different than what it really does
  Process p = new Process();
  p.StartInfo = info;
  p.Start();
  p.WaitForInputIdle();
  System.Threading.Thread.Sleep(tp);
  if (false == p.CloseMainWindow())
  {
     p.Kill();
  }
  Message m = new Message() { Msg = "Worked, yo", MsgType = Message.MessageType.Success };
  Logger.Log(m);
  return true;
}
catch (Exception ex)
{               
    //I log this I swear
    return false;
}

我希望能够找到解决方案/帮助/答案的正确方向。

由于

0 个答案:

没有答案
相关问题