Problems executing external application (.exe) using windows service

  • Thread starter Thread starter Jay
  • Start date Start date
J

Jay

hi
i am jay from bangalore
i have one problem ,can u please help me out.

i have one windows application and one windows service.
from windows application i have to call one process "gpg" to encrypt
my text file so i use
system.Diagnostics.process class to make new process.
my code is like this


Process processEncryption = new Process();
processEncryption.StartInfo.WorkingDirectory = @"c:\Gnu\GNUPg";
processEncryption.StartInfo.FileName = "gpg";
processEncryption.StartInfo.Arguments = @" -o " + "\"" + path +
fileName + "\"" + " --passphrase " + passphrase + " -d " + "\"" + path
+ fileName + ".gpg" + "\"";
processEncryption.Start();
processEncryption.WaitForExit();

this code work fine if i use this code in windows application
but it does not work at all in windows service .code runs comepletely
but does not produce any output "
it seems that this code is not able to start process "gpg" if we run in
windows service.
can u help me

thanx in advance
 
Hi,

Probably permissions problems.

under what user the service is running?

Does that user has permission to read the source and write in the selected
directory?
 
Hi,


How the output is produced? does it generate a file? are you passig the
fullpath for this new file?

Are you getting any exception?

Also check the exit code of the .exe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top