我正在尝试PSExec从我的 Asp.Net Web 应用程序执行以连接到远程服务器。不知何故,它"Access Denied Error -5"没有设置凭据,而是通过在 PSEXEC 命令中设置凭据来提供  "2250 Network connection could not be found". 我是服务器上的管理员并且我已Windows authentication and Asp.Net Impersonation启用 ( IIS7.5)。更有趣的是,当我尝试从 a 执行此操作时,console application甚至仅使用command prompt它就可以正常工作。我试图做一个 ping 操作作为测试。
这是我的代码片段:-
            var startInfo = new ProcessStartInfo{
                CreateNoWindow = true,
                UseShellExecute = false,
                FileName = FilePath,
                Arguments = CommandArgs
            }
            Process vsCommandProcess = Process.Start(startInfo);
            vsCommandProcess.WaitForExit();
            var exitCode = vsCommandProcess.ExitCode;
            if (vsCommandProcess.ExitCode != 0)
            {
                ...rest of the code
这里:-
FilePath --> C:\pstools\psexec.exe
Arguments --> \\servername -accepteula -u domain\userName -p password ipconfig (1)
               \\servername -accepteula ipconfig (2)         
(1) Gives Error 2250 (2) gives Error 5
相同的命令和代码适用于控制台应用程序。所以我相信这肯定与 Asp.net 应用程序有关,它无法将凭据转移到远程机器上。我尝试过startInfo.LoadUserProfile但无济于事。
感谢你的帮助。我试图查找类似的问题,但找不到解决我面临的问题的方法。