By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,238 Members | 1,804 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,238 IT Pros & Developers. It's quick & easy.

CALLING EXE IN A SEPERATE PROCESS THAN THE WINDOWS SERVICE

P: n/a
Hi,

I have a working windows service,it is looking for files on the disk
and when some of the files are cupdated it calls an executable. But it
takes a lot of time(about 10 minutes) to run the executable.So while
that executable is running,if I try to stop the windows service while
the executable(MYPROGRAM.EXE) is running,it will wait for a time(about
20 seconds) for the main windows thread to abort.If it does not finish
its work, the service process is killed AUTOMATICALLY and tells
something like "the service did not stop ina timely fashion".
As the windows service will never be able to finish its work under a
minute,
my service always is stooped by WINDOWS and got the message "the
service did not stop ina timely fashion".

I need a asynchronous way to execute the MYPROGRAM.EXE in a different
process than the windows service process so that even if the service
stops,if MYPROGRAM.EXE will continue to run..

One way to do is to call a web service method asynchronously which
executes MYPROGRAM.EXE ...So the .NET code for the windows service
will not suspend when it calls the windows service method. and will
stop ina timely fashion when it is signaled. But I think there should
be better ways of implementing it without using IIS.

I'll appreciate very much if you help...
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Why do you want to stop the service in the first place? Windows services are
generally ment to run from boot-up to shutdown.
How do you start the external process? A code snippet would help.

Willy.

"belgiozen" <be*******@yahoo.com> wrote in message
news:4e**************************@posting.google.c om...
Hi,

I have a working windows service,it is looking for files on the disk
and when some of the files are cupdated it calls an executable. But it
takes a lot of time(about 10 minutes) to run the executable.So while
that executable is running,if I try to stop the windows service while
the executable(MYPROGRAM.EXE) is running,it will wait for a time(about
20 seconds) for the main windows thread to abort.If it does not finish
its work, the service process is killed AUTOMATICALLY and tells
something like "the service did not stop ina timely fashion".
As the windows service will never be able to finish its work under a
minute,
my service always is stooped by WINDOWS and got the message "the
service did not stop ina timely fashion".

I need a asynchronous way to execute the MYPROGRAM.EXE in a different
process than the windows service process so that even if the service
stops,if MYPROGRAM.EXE will continue to run..

One way to do is to call a web service method asynchronously which
executes MYPROGRAM.EXE ...So the .NET code for the windows service
will not suspend when it calls the windows service method. and will
stop ina timely fashion when it is signaled. But I think there should
be better ways of implementing it without using IIS.

I'll appreciate very much if you help...

Nov 15 '05 #2

P: n/a
fork a thread in your service's main routine to do that work, then the main
service checking can be happy and you'll get the results you need when they
are ready.

--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
er**@cc.ensoft-software.com [remove the first "CC."]

"belgiozen" <be*******@yahoo.com> wrote in message
news:4e**************************@posting.google.c om...
Hi,

I have a working windows service,it is looking for files on the disk
and when some of the files are cupdated it calls an executable. But it
takes a lot of time(about 10 minutes) to run the executable.So while
that executable is running,if I try to stop the windows service while
the executable(MYPROGRAM.EXE) is running,it will wait for a time(about
20 seconds) for the main windows thread to abort.If it does not finish
its work, the service process is killed AUTOMATICALLY and tells
something like "the service did not stop ina timely fashion".
As the windows service will never be able to finish its work under a
minute,
my service always is stooped by WINDOWS and got the message "the
service did not stop ina timely fashion".

I need a asynchronous way to execute the MYPROGRAM.EXE in a different
process than the windows service process so that even if the service
stops,if MYPROGRAM.EXE will continue to run..

One way to do is to call a web service method asynchronously which
executes MYPROGRAM.EXE ...So the .NET code for the windows service
will not suspend when it calls the windows service method. and will
stop ina timely fashion when it is signaled. But I think there should
be better ways of implementing it without using IIS.

I'll appreciate very much if you help...

Nov 15 '05 #3

P: n/a
The background thread being forked by the main thread will be killed
by the runtime when the service is stopped.So that's not the solution
in my opininion.
Maybe Process Class will help me do that.. starting the exe in a
different process to avoid it being killed even if the service process
stops....


"Eric Newton" <er**@cc.ensoft-software.com> wrote in message news:<#d*************@TK2MSFTNGP11.phx.gbl>...
fork a thread in your service's main routine to do that work, then the main
service checking can be happy and you'll get the results you need when they
are ready.

--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
er**@cc.ensoft-software.com [remove the first "CC."]

"belgiozen" <be*******@yahoo.com> wrote in message
news:4e**************************@posting.google.c om...
Hi,

I have a working windows service,it is looking for files on the disk
and when some of the files are cupdated it calls an executable. But it
takes a lot of time(about 10 minutes) to run the executable.So while
that executable is running,if I try to stop the windows service while
the executable(MYPROGRAM.EXE) is running,it will wait for a time(about
20 seconds) for the main windows thread to abort.If it does not finish
its work, the service process is killed AUTOMATICALLY and tells
something like "the service did not stop ina timely fashion".
As the windows service will never be able to finish its work under a
minute,
my service always is stooped by WINDOWS and got the message "the
service did not stop ina timely fashion".

I need a asynchronous way to execute the MYPROGRAM.EXE in a different
process than the windows service process so that even if the service
stops,if MYPROGRAM.EXE will continue to run..

One way to do is to call a web service method asynchronously which
executes MYPROGRAM.EXE ...So the .NET code for the windows service
will not suspend when it calls the windows service method. and will
stop ina timely fashion when it is signaled. But I think there should
be better ways of implementing it without using IIS.

I'll appreciate very much if you help...

Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.