473,385 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

.NET Windows Service help

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
Nov 16 '05 #1
2 2130
"Girish" <gb****@tietronixinc.com> wrote in message
news:eg**************@TK2MSFTNGP09.phx.gbl...
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
Nov 16 '05 #2
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/de...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/de...us/vbcon/html/
vbconserviceapplicationprogrammingarchitecture.asp

Also, you may use ServiceController class, please refer to:
"Communicate With Windows Services"
http://msdn.microsoft.com/library/de...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/is...v/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.

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: CK | last post by:
I need a windows service that listens to a directory , if any xml file is placed in the directory it reads it and calls a class and receives a string.. this is the code I came up with. it works but...
0
by: summer | last post by:
How can I use c# make a windows Service I use this project create windows service How can i add timer in it ,and add where I want use this to check and send mail
5
by: Girish | last post by:
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...
5
by: Andrew | last post by:
Hey all, Requesting help from the VB.Net gurus in here. I was given a task to write a Windows Service (VB.Net) that would run an external program, and if that program closed for any reason...
2
by: Jack | last post by:
Hello, I am tring to run a CMD Line app from a Windows Service and it won't run. Any help would be great!! Thanks, Jack
5
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.