2014-09-03 61 views
0

當我嘗試從visualstudio 2012 Webforms應用程序運行PSEXEC時。我得到以下錯誤: - StandardOut尚未重定向或該過程尚未開始。VisualStudio 2012從web應用程序錯誤中運行PSEXEC

我有一些非常基本的問題,以瞭解: -

  1. 當我運行它運行在本地主機上的web應用:2322/Default.aspx的。那麼localhost默認運行在「DefaultAppPool」上嗎?
  2. ApplicationPoolIdentity正在內置帳戶「ApplicationPoolIdentity」上運行我試圖在IIS 7.5中將其更改爲「本地系統」和「網絡服務」,但仍然會引發上述錯誤。

下面是我的代碼: -

var startInfo = new ProcessStartInfo 
      { 
       CreateNoWindow = true, 
       UseShellExecute = false, 
       RedirectStandardError = true, 
       RedirectStandardInput = true, 
       FileName = @"E:\PSTools\PSExec.exe", 
       Arguments = @"\\machineA -u domain\username -p passwrd c:\Installer.exe" 
      }; 

      Process p = Process.Start(startInfo); 
      string output = p.StandardOutput.ReadToEnd(); 
      string errormessage = p.StandardError.ReadToEnd(); 
      p.WaitForExit(); 

感謝,

回答