开发者

System.Diagnostics.Process.Start() is generating Application Popup error message in the event logs

I am using following piece of code to perform IISReset on the remote servers using an Asp.Net Web application. Website is hosted on a windows server 2003 machine with IIS 6.0 and remote servers are also running windows server 2003 (IIS 6.0). This code is working absolutely fine in my development environment and successfully performing an IIS Reset on the remote servers but when i deployed this on the live server it is doing nothing. Application is almost un-responsive when I am clicking the button to reset IIS on the web page and generating the following error in the event log.:

*Application popup: iisreset.exe - Application Error : The application failed to initialize properly (0xc0000142). Click on OK to terminate the application.*

string pass = CommonMethods.GetSecureAppSettings("priviledgedUserPwd");
    ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
    psi.UserName = CommonMethods.GetSecureAppSettings("priviledgedUser");
    psi.Password = pass.ToSecureString();
    psi.FileName = @CommonMethods.GetAppSettings("ExecutablePath") + "iisreset.exe";
    psi.WindowStyle = ProcessWindowStyle.Normal;
    psi.Arguments = server.IP;
    psi.RedirectStandardOutput = true;
    psi.UseShellExecute = false;
    System.Diagnostics.Process listFiles;
    listFiles = Process.Start(psi);
    StreamReader outPut = listFiles.StandardOutput;
    listFiles.WaitForExit(10000);
    if (listFiles.HasExited)
    {
        Logger.Audit(AUDIT_TITLE, outPut.ReadToEnd());
    }
    else
    {
        throw new Exception("Failed to start the process successfully");
    }
    return listFiles.ExitCode;

Here executable path is C:\Windows\System32 and priviledged user is a member of Administrators group so all the permissions are already in place. I have 开发者_开发技巧tried impersonation as well without any help.

Please suggest how to investigate this problem further.

Many Thanks in advance.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜