C# code to run a batch file works in console application, but same code doesnt work in WCF Service -
this following code pretty simple , works in console application. reason not work in wcf service. directory has batch file has full permissions. can me? missing?
try { processstartinfo psi = new processstartinfo(); //specify name , arguements want pass psi.filename = configurationmanager.appsettings["batchfilelocation"]; psi.arguments = filepath; //create new process , set starting information process p = new process(); p.startinfo = psi; //set can tell when process has completed p.enableraisingevents = true; p.start(); //wait until process has completed while (!p.hasexited) { system.threading.thread.sleep(1000); } //check see exit code if (p.exitcode != 0) { logger.write(p.exitcode); } } catch (exception ex) { logger.write(ex.message); }
i assume iis hosted wcf service.
check identity associated application pool.
in iis 7, , 6.0 best of knowledge, networkservice, may or may not have rights batch file, sftp, etc. in 7.5 there account: default application pool id changed in iis 7.5. possible pool using other account, including machine specific one, , not domain account.
Comments
Post a Comment