.NET Windows Service help

  • Thread starter Thread starter Girish
  • Start date Start date
G

Girish

Im looking for information on how to build a windows service (not web
service) on a .net enabled platform.

Now, ive had some experience building services using vc++ 6.0 - and I can
tell you its not straightforward. Now, I tried to examine the code that was
auto generated when you create a new windows service project in vs.net 2003
(C#). I could not see any code for
1) Installing, uninstalling services. How can this be done in the .net way?
2) Messages that need to be passed to the Service Control Manager at regular
intervals eg SERVICE_STOP_PENDING, SERVICE_RUNNING, etc. What happened to
those messages? Dont they need to be passed to the SCM anymore?

Id like to know the gutts of how windows services are implemented in the
..net way so I can relate them to my experience with building them in vc++
6.0. Any articles or code samples for this?

Any help would be greatly appreciated.

Thanks,
Girish
 
Girish said:
Id like to know the gutts of how windows services are implemented in the
.net way so I can relate them to my experience with building them in vc++
6.0. Any articles or code samples for this?

Check out ServiceBase in MSDN. The wizard-generated service derives from
that class. The docs also cover installation/uninstallation. It pretty
much just abstracts all of the control messages into virtual functions you
can override (e.g. OnXXX), and abstracts the startup process so you can fill
out an array of sub-services to run. The meta-data you provide at build
time tells the install utility what to register.

Some notable omissions are the ability to provide wait-hints to the SCM for
lengthy start and stop operations, and the ability to tweak some of the
newer settings, like failure actions.

Mike
 
Hi Girish,

Based on my understanding, you want to know how to an installer application
for your windows service application. Also, you want to know to how control
the windows service.

There is a workthrough tells you how to create a windows service:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbwlkwalkthroughcreatingwindowsserviceapplication.asp

In the article, "To create the installers for your service" section teaches
you to add installer for your service.

To control the windows service, the ServiceBase class provided several
methods for you to override, please refer to:
"Service Application Programming Architecture"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbconserviceapplicationprogrammingarchitecture.asp

Also, you may use ServiceController class, please refer to:
"Communicate With Windows Services"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvsm02/htm
l/vs0201dt.asp

At last, this article give you an overall view:
"Windows Services: New Base Classes in .NET Make Writing a Windows Service
Easy"
http://msdn.microsoft.com/msdnmag/issues/01/12/NETServ/default.aspx

====================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Girish,

Does my reply makes sense to you? Do you still have any concern?

Please feel free to let me know, I will help you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top