Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Prevent service from stopping

Reply
Thread Tools

Prevent service from stopping

 
 
ThunderMusic
Guest
Posts: n/a
 
      01-11-2006
Hi,
I have a service which is only a server for some objects the user can
instanciate and call.

Right now, the service starts and then stops automaticaly. The only line of
code I added is in the OnStart event and is
"RemotingConfiguration.Configure(configfile)". So I guess the service is
stopping because it has nothing better to do?

Is there a setting I can set to prevent it from stopping? will I have to
start a loop that will run until the OnStop event runs in order to keep the
service alive?

Thanks

ThunderMusic


 
Reply With Quote
 
 
 
 
Ramu Nallamothu
Guest
Posts: n/a
 
      01-11-2006
Did you try changing the service startup type to "Manual". ?

Thanks.
Ramu



"ThunderMusic" <NOdanlatSPAM@hotmaildotcom> wrote in message
news:...
> Hi,
> I have a service which is only a server for some objects the user can
> instanciate and call.
>
> Right now, the service starts and then stops automaticaly. The only line
> of code I added is in the OnStart event and is
> "RemotingConfiguration.Configure(configfile)". So I guess the service is
> stopping because it has nothing better to do?
>
> Is there a setting I can set to prevent it from stopping? will I have to
> start a loop that will run until the OnStop event runs in order to keep
> the service alive?
>
> Thanks
>
> ThunderMusic
>



 
Reply With Quote
 
 
 
 
ThunderMusic
Guest
Posts: n/a
 
      01-11-2006
no, I want it to be automatic... I just want it to stay alive after it
starts...


"Ramu Nallamothu" <> wrote in message
news:%...
> Did you try changing the service startup type to "Manual". ?
>
> Thanks.
> Ramu
>
>
>
> "ThunderMusic" <NOdanlatSPAM@hotmaildotcom> wrote in message
> news:...
>> Hi,
>> I have a service which is only a server for some objects the user can
>> instanciate and call.
>>
>> Right now, the service starts and then stops automaticaly. The only line
>> of code I added is in the OnStart event and is
>> "RemotingConfiguration.Configure(configfile)". So I guess the service is
>> stopping because it has nothing better to do?
>>
>> Is there a setting I can set to prevent it from stopping? will I have to
>> start a loop that will run until the OnStop event runs in order to keep
>> the service alive?
>>
>> Thanks
>>
>> ThunderMusic
>>

>
>



 
Reply With Quote
 
Gregory Gadow
Guest
Posts: n/a
 
      01-11-2006
ThunderMusic wrote:

> no, I want it to be automatic... I just want it to stay alive after it
> starts...


Perhaps if you gave it something to do? A timing loop, something like that.
--
Gregory Gadow


 
Reply With Quote
 
Doug Forster
Guest
Posts: n/a
 
      01-12-2006
Hi,

> "RemotingConfiguration.Configure(configfile)". So I guess the service is
> stopping because it has nothing better to do?


No.
If you are using the default generated code for the service this should
include a call to System.ServiceProcess.ServiceBase.Run in its Main. This
keeps the service running until it is explicitly stopped.

The usual reason for a service mysteriously stopping is an exception (which
doesn't show because services don't have a UI by default).

Cheers
Doug Forster

"ThunderMusic" <NOdanlatSPAM@hotmaildotcom> wrote in message
news:...
> Hi,
> I have a service which is only a server for some objects the user can
> instanciate and call.
>
> Right now, the service starts and then stops automaticaly. The only line
> of code I added is in the OnStart event and is
> Is there a setting I can set to prevent it from stopping? will I have to
> start a loop that will run until the OnStop event runs in order to keep
> the service alive?
>
> Thanks
>
> ThunderMusic
>



 
Reply With Quote
 
Phil Wilson
Guest
Posts: n/a
 
      01-12-2006
OnStart is an "event" that gets called when your Service is initiated, to do
initialization etc. You would typically start a thread there (ThreadStart
for some method you run) that runs until some event happens, you trigger
that event in OnStop().
--
Phil Wilson [MVP Windows Installer]
----
"ThunderMusic" <NOdanlatSPAM@hotmaildotcom> wrote in message
news:...
> Hi,
> I have a service which is only a server for some objects the user can
> instanciate and call.
>
> Right now, the service starts and then stops automaticaly. The only line
> of code I added is in the OnStart event and is
> "RemotingConfiguration.Configure(configfile)". So I guess the service is
> stopping because it has nothing better to do?
>
> Is there a setting I can set to prevent it from stopping? will I have to
> start a loop that will run until the OnStop event runs in order to keep
> the service alive?
>
> Thanks
>
> ThunderMusic
>



 
Reply With Quote
 
Igor
Guest
Posts: n/a
 
      01-12-2006
ThunderMusic wrote:
> Hi,
> I have a service which is only a server for some objects the user can
> instanciate and call.
>
> Right now, the service starts and then stops automaticaly. The only line of
> code I added is in the OnStart event and is
> "RemotingConfiguration.Configure(configfile)". So I guess the service is
> stopping because it has nothing better to do?
>
> Is there a setting I can set to prevent it from stopping? will I have to
> start a loop that will run until the OnStop event runs in order to keep the
> service alive?
>
> Thanks
>
> ThunderMusic
>
>

spawn a thread or a backgroundworker in the onstart method that does the listening (
while run_flag
system.threading.thread.sleep(150)
end while
).
Onstart is only the initializer, not the worker - i.e. if you loop in onstart, you will get an error that the service did not respond in a timely fashion...

on onstop method set the run_flag to false and release resources.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to prevent uTorrent from stopping on WinXP screensaver Donna Richoux Computer Support 17 03-14-2007 11:28 PM
prevent screensaver from stopping Volker Computer Support 2 10-26-2005 02:37 AM
3rd Party app stopping Zero config service on startup =?Utf-8?B?QW5ndXMgUm9va2U=?= Wireless Networking 1 08-20-2005 06:55 AM
How to prevent the script from stopping before it should python@hope.cz Python 7 01-19-2005 03:01 PM
Re: Stopping services. Service: iisadmin joe ASP .Net 1 07-10-2003 05:58 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57