Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

process.start is not working in Windows Service

40 views
Skip to first unread message

Reddy

unread,
Oct 11, 2006, 2:26:02 PM10/11/06
to
I am running process.sart to run gpg.exe to encrypt files. It's working fine
with console application. When i use same code in windows service. It's not
working. It's not even throwing error.Follwoing is the code i am using.
Please somebody help me.

Process p = new Process();
p.StartInfo.WorkingDirectory = Path;
p.StartInfo.FileName = fileName;
p.StartInfo.Arguments =arguments;
p.Start();
p.WaitForExit();

Thank You
Reddy

Michael Nemtsev

unread,
Oct 11, 2006, 3:44:13 PM10/11/06
to
Hello Reddy,

I think that it's not very good idea to start process from service.
Service works in different context then your app, and can be start before
any user log on.

Try to divide starting app from service, service can inform other user's
app to start you process

R> I am running process.sart to run gpg.exe to encrypt files. It's
R> working fine with console application. When i use same code in
R> windows service. It's not working. It's not even throwing
R> error.Follwoing is the code i am using. Please somebody help me.
R>
R> Process p = new Process();
R> p.StartInfo.WorkingDirectory = Path;
R> p.StartInfo.FileName = fileName;
R> p.StartInfo.Arguments =arguments;
R> p.Start();
R> p.WaitForExit();
R> Thank You
R> Reddy
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche


Reddy

unread,
Oct 11, 2006, 4:39:02 PM10/11/06
to
Thanks Michale, I didn't quite get what you said. "Try to divide starting app
from service, service can inform other user's app to start you process"

Could you please give some example?

Thanks
reddy

Michael Nemtsev

unread,
Oct 11, 2006, 4:50:05 PM10/11/06
to
Hello Reddy,

Create small user app that is started when user log on and that will be responsible
for starting new process. Name it like ProcessFactory.
When your service need to start new process just inform it about your ProcessFactory
(via IPC) and your ProcessFactroy will start required process

R> Thanks Michale, I didn't quite get what you said. "Try to divide
R> starting app from service, service can inform other user's app to
R> start you process"
R>
R> Could you please give some example?
R>
R> Thanks
R> reddy

Reddy

unread,
Oct 11, 2006, 5:16:02 PM10/11/06
to
Michael,
I never used IPC. Is it available in 1.1? If so Could you please tell me
how to use IPC.

Thank you very much for your responses.

Michael Nemtsev

unread,
Oct 11, 2006, 11:47:19 PM10/11/06
to
Hello Reddy,

IPC is a general name for such things like Sockets, Pipes, Mailslot, remoting,
dcom, filemapping and etc - everything that imply interaction between processes.

You need to select which way of IPC suites u the best.

I recomend to look there for the samples of IPC http://www.codeproject.com/info/search.asp?cats=3&cats=4&cats=5&cats=6&searchkw=ipc&Submit1=Search&author=&sd=15+Nov+1999&ed=11+Oct+2006

In your case, where only message notification is required, I'd select the
remoting with events


R> Michael,
R> I never used IPC. Is it available in 1.1? If so Could you please
R> tell me
R> how to use IPC.
R> Thank you very much for your responses.
R>
R> "Michael Nemtsev" wrote:
R>

0 new messages