Yoyo Services

G

Guest

Hi,
I've been trying to create a windows service that handles some system
events, but when I try to start it stops immediately; it yoyos. I read
somewhere that even a the service template should keep running but I built a
copy of it and it too yoyoed. I've tried putting infinite Thread.Sleep loops
in the Main method but they don't work. Is there something that I've
forgotten to put in my code? I feel like I've tried everything!

From,
Reuben
 
D

Daniel O'Connell [C# MVP]

Reuben said:
Hi,
I've been trying to create a windows service that handles some system
events, but when I try to start it stops immediately; it yoyos. I read
somewhere that even a the service template should keep running but I built
a
copy of it and it too yoyoed. I've tried putting infinite Thread.Sleep
loops
in the Main method but they don't work. Is there something that I've
forgotten to put in my code? I feel like I've tried everything!

Built a copy of what? The template or your service?

First thing, check your event log and see if there is any mention of why the
service is stopping. Then add logging to your service to see where its
stopping. If you can narrow it down to where the problem is it'll be much
easier to fix.
 
G

Guest

Thanks. I've found out that an exception occurs in the OnStart function when
I try to hook up my event handler to
Microsoft.Win32.SystemEvents.SessionEnding. Problem s, I don't understand it.
Do you (see below).
Thanks for your help.
Reuben.
=====================================================
Event Type: Error
Event Source: Symbiosis
Event Category: None
Event ID: 0
Date: 30/09/2005
Time: 5:04:31 PM
User: N/A
Computer: MAIN
Description:
The description for Event ID ( 0 ) in Source ( Symbiosis ) cannot be found.
The local computer may not have the necessary registry information or message
DLL files to display messages from a remote computer. You may be able to use
the /AUXSOURCE= flag to retrieve this description; see Help and Support for
details. The following information is part of the event: Service cannot be
started. System.Runtime.InteropServices.ExternalException: Failed to create
system events window thread.
at Microsoft.Win32.SystemEvents.EnsureSystemEvents(Boolean requireHandle,
Boolean throwOnRefusal)
at
Microsoft.Win32.SystemEvents.add_SessionEnding(SessionEndingEventHandler
value)
at Symbiosis.Symbiosis.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object
state).
 
G

Guest

Reuben said:
Thanks. I've found out that an exception occurs in the OnStart function when
I try to hook up my event handler to
Microsoft.Win32.SystemEvents.SessionEnding. Problem s, I don't understand it.
Do you (see below).
Thanks for your help.
Reuben.
=====================================================
Event Type: Error
Event Source: Symbiosis
Event Category: None
Event ID: 0
Date: 30/09/2005
Time: 5:04:31 PM
User: N/A
Computer: MAIN
Description:
The description for Event ID ( 0 ) in Source ( Symbiosis ) cannot be found.
The local computer may not have the necessary registry information or message
DLL files to display messages from a remote computer. You may be able to use
the /AUXSOURCE= flag to retrieve this description; see Help and Support for
details. The following information is part of the event: Service cannot be
started. System.Runtime.InteropServices.ExternalException: Failed to create
system events window thread.
at Microsoft.Win32.SystemEvents.EnsureSystemEvents(Boolean requireHandle,
Boolean throwOnRefusal)
at
Microsoft.Win32.SystemEvents.add_SessionEnding(SessionEndingEventHandler
value)
at Symbiosis.Symbiosis.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object
state).

Reuben,
Try running your service under a Username/Password account and not the
System account. Start from there.
Francisco
 

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