manually writing a windows service

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'd like to write a windows service. Unfortunately, my company would only spring for the standard edition of VB.NET which doesn't support the creation of windows services. Is it possible to write one manually? If not, are there any other (cheaper) tools available? Any free ones?
 
its really easy to write a basic service just using the SDK which is free.
The quickstart tutorial has examples of code for it.

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP


Glenn Venzke said:
I'd like to write a windows service. Unfortunately, my company would only
spring for the standard edition of VB.NET which doesn't support the creation
of windows services. Is it possible to write one manually? If not, are there
any other (cheaper) tools available? Any free ones?
 
Glenn said:
I'd like to write a windows service. Unfortunately, my company would
only spring for the standard edition of VB.NET which doesn't support
the creation of windows services. Is it possible to write one
manually? If not, are there any other (cheaper) tools available? Any
free ones?

Do you really need a service? You need a service for one or more of these
reasons:

1) it must run when no one is logged on
2) it must run all the time (that is, if it faults, it must be restarted)
3) it has special security requirements that you don't expect the
interactive user to have

Don't use services to play tricks: if you want to communicate with the
interactive user you should write two processes - the service and another
one that runs under the interactive user account and talks to the service
via an interprocess communication mechanism. Clicking on the 'allow service
to interact with the desktop' is asking for trouble.

Also if #3 is your intention, be careful. If you run under the LOCALSYSTEM
account you get complete access to the OS (this account has TCB privileges -
Trusted Computing Base, that is, it *is* the operating system), so you can
really screw up the system because LOCALSYSTEM can do more or less
*anything*. Plus LOCALSYSTEM by default does not have network privileges.

Note that services *must* be installed on the machine (ie in the registry),
and hence they don't follow the .NET ideal of 'XCOPY deployment'. Services
also have some important threading and initialization issues. If you don't
know what these are then its probably better not to write a service.

Whenever I find someone writing a service I invariably find that they don't
need any of these three criteria and since a service is, in effect,
extending the operating system, I usually tell them that they don't need a
service!

Richard
 
Back
Top