process.start is not working in Windows Service

G

Guest

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
 
M

Michael Nemtsev

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 Nietzsch
 
G

Guest

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
 
M

Michael Nemtsev

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
---
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
 
G

Guest

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.
 
M

Michael Nemtsev

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/sea...=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>---
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 Nietzsch
 

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

Top