Click here to Skip to main content
15,922,155 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,

How to create windows service for system start in c# .net?

My window service should be start,when user system open.
or OnElapsed time should be start when user system open.

Not any specific time for windows service start.

Please help me.

Thanks in Advance.

Ankit Agarwal
Software Engineer
Posted
Comments
Sergey Alexandrovich Kryukov 17-Apr-14 2:06am    
What does it mean "user system open"?
—SA
[no name] 17-Apr-14 2:08am    
my windows service could not start any specific time, when user will be open the system, so my windows service will be run.

Any Windows Service can start with system start. This is defined by its start options; please see the "Services" Control Panel applet.

Other system events can be handled by using the class Microsoft.Win32.SystemEvents:
http://msdn.microsoft.com/en-us/library/microsoft.win32.systemevents%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 
Windows Services are started automatically when computer is booted. They do not require a logged in user in order to execute and can run under the context of any user including the system. Windows Services are controlled through the Service Control Manager where they can be stopped, paused, and started as needed.
 
Share this answer
 
Comments
[no name] 17-Apr-14 2:37am    
ya i know windows service started when computer will be start but "OnElapsedTime" will now fired, It will be fired on specific time but I not fire on specific time, user when will be start computer so, OnElapsedTime or my service functionality run.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900