C# System.Diagnostics.Process launches on my local IIS, but doesn't launch on the server -
i'm trying make program run bat file, launches exe file. works fine on local computer, doesn't work on server iis. doesn't work regardless of whether specify username , password in processstartinfo or not. i've searched forums , applied different stuff, none of them help.
in windows event viewer doesn't give me errors process output. if change directory , can't find bat file, output gives me error, when finds file, doesn't return , doesn't launch program.
now, if provide credentials process, specifying psi.domain, psi.username , psi. password, standartoutput doesn't return error, windows events gives me 2 following errors:
application popup: cmd.exe - application error : application unable start correctly (0xc0000142). click ok close application.
and
application popup: conhost.exe - application error : application unable start correctly (0xc0000142). click ok close application.
here's code:
system.diagnostics.processstartinfo psi = new system.diagnostics.processstartinfo(@"c:\inetpub\copytoad\pspasswd\passchange.bat"); psi.redirectstandardoutput = true; psi.redirectstandardinput = true; psi.redirectstandarderror = true; psi.createnowindow = true; psi.windowstyle = system.diagnostics.processwindowstyle.hidden; psi.useshellexecute = false; system.diagnostics.process listfiles; listfiles = new system.diagnostics.process(); listfiles.enableraisingevents = false; listfiles.startinfo = psi; listfiles.start(); system.io.streamreader myoutput = listfiles.standardoutput; listfiles.waitforexit(2000); myoutput.readtoend(); string output = myoutput.readtoend(); viewbag.view6 += output + "***"; if (listfiles.hasexited) { output = myoutput.readtoend(); viewbag.view6 += output; }
Comments
Post a Comment