C# VisualStudio 2012从Web应用程序运行PSEXEC错误

C# VisualStudio 2012从Web应用程序运行PSEXEC错误,c#,asp.net,visual-studio-2012,C#,Asp.net,Visual Studio 2012,当我尝试从visualstudio 2012 Webforms应用程序运行PSEXEC时。我得到以下错误:- StandardOut尚未重定向或该过程尚未启动 我有一些非常基本的问题需要理解:- 当我运行webapplication时,它在localhost:2322/default.aspx上运行。那么,本地主机是否默认在“DefaultAppPool”上运行 ApplicationPoolIdentity正在内置帐户“ApplicationPoolIdentity”上运行。我尝试在IIS 7

当我尝试从visualstudio 2012 Webforms应用程序运行PSEXEC时。我得到以下错误:- StandardOut尚未重定向或该过程尚未启动

我有一些非常基本的问题需要理解:-

  • 当我运行webapplication时,它在localhost:2322/default.aspx上运行。那么,本地主机是否默认在“DefaultAppPool”上运行
  • 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();
    

    谢谢,

    我想您需要添加“RedirectStandardOutput=true”


    感谢您的回复。这解决了该错误。但是我遇到了远程服务器连接问题。如何在c#中以编程方式获取process.start运行时所使用的用户帐户/凭据?