all groups > dotnet myservices > january 2006 >
You're in the

dotnet myservices

group:

Calling console applications - problem


Calling console applications - problem Mystique
1/9/2006 8:21:41 PM
dotnet myservices: Hi
I have created a Windows Service in C# that calls other (console)
applications that operate on files. I call a console application (PGP.exe)
that encodes a file and creates a new encoded file. The source code is:

Process aPGPSigning = new Process();
ProcessStartInfo anInfo = new ProcessStartInfo();
anInfo.FileName = "PGP.exe";
String anArguments = "-s ";
anArguments += inFile;
anInfo.Arguments = anArguments;
anInfo.UseShellExecute = true;
aPGPSigning.StartInfo = anInfo;
aPGPSigning.Start();

The encoded file does not get created from the service, but if I call the
console application (PGP.exe) to encode the file from the command line, it
works.
Is there any special case for calling other applications form services, or
maybe the user does not have permissions to create the file (the folder was
given full permissions), or is it another problem ?

Regards,
Mystique

Re: Calling console applications - problem Lee Gillie
1/30/2006 11:55:45 AM
[quoted text, click to view]
I generally capture both SYSOUT and SYSERR from the processes I create,
then to run CMD.EXE having it run my EXE. I log the captured output so I
can diagnose problems, such as yours. Running CMD.EXE gives you all
shell services. Essentially when you create a command line you are
AddThis Social Bookmark Button