By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,244 Members | 1,772 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,244 IT Pros & Developers. It's quick & easy.

windows service... when do we need installer

P: n/a
Hi All,
i have some doubts on .net windows services..
please see if some one could help me understand this..

1)is it possible to install a windows service which does not have a
installer added to it,
using installutil.exe

OR
is it must to have an installer to the service project to be able to
install it using installutil.exe

2)why exactly do you have to add installer to a
..net windows service project .
some of the samples i saw were for creating a custom event log ,or for
performance counter ..but it should be possible to do all this even
in the "OnStart" or in the constructor of the windows service.
so when exactly would you need a installer.

thanks
siddharth
Jul 21 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
sidd wrote:
Hi All,
i have some doubts on .net windows services..
please see if some one could help me understand this..

1)is it possible to install a windows service which does not have a
installer added to it,
using installutil.exe
My experience ( I have writen a few windows services so far ) is that it
needs the installer. I have seen some articles ( in c-sharpfriends, for
example ) where they don't mention the installer. But in the MS
documentation for creating a web service, they say to add the installer.

It's very simple to do anyway and it adds a lot of properties, such as start
automatically, or manually , so why not do it.

OR
is it must to have an installer to the service project to be able to
install it using installutil.exe

2)why exactly do you have to add installer to a
.net windows service project .
some of the samples i saw were for creating a custom event log ,or for
performance counter ..but it should be possible to do all this even
in the "OnStart" or in the constructor of the windows service.
so when exactly would you need a installer.
The installer seems to be the 'hook' for allowing the OS to install and run
the service.

Other than adding it to allow me to 'install' the service, I have never used
it for anything else. Like you, I put all the tracing and logging and so
on in the service code itself.

thanks
siddharth


--
incognito @ http://kentpsychedelic.blogspot.com/

Jul 21 '05 #2

P: n/a
Hi siddharth,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know when an installer
class is needed in a windows service application. If there is any
misunderstanding, please feel free to let me know.

As far as I know, if you need to install the windows service to your
computer, the installer class is required. The installutil.exe need to get
information from it to decide properties for that service. For example, a
service's StartType may be set to start the service automatically at reboot
or require a user to start the service manually. Also Install and Uninstall
methods are called during installation and uninstallation. The service
cannot be installed onto the machine without the installer class.

The OnStart or the constructor of the windows service does things when
service starts, while the installer class does things when the service is
being installed.

For more information, please check the following link:

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfSystemServiceProcessServiceInstallerClassTopi c.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #3

P: n/a
Hello Sidd,

I've only created two production windows services, and this wasn't a
stumbling block. However, from my experience:

The application needs code, in it, that will run on installation. It does
not need for you to package it as an MSI. You can run the code (the
installer class) by calling installutil.

--- N

"sidd" <si************@hotmail.com> wrote in message
news:af*************************@posting.google.co m...
Hi All,
i have some doubts on .net windows services..
please see if some one could help me understand this..

1)is it possible to install a windows service which does not have a
installer added to it,
using installutil.exe

OR
is it must to have an installer to the service project to be able to
install it using installutil.exe

2)why exactly do you have to add installer to a
.net windows service project .
some of the samples i saw were for creating a custom event log ,or for
performance counter ..but it should be possible to do all this even
in the "OnStart" or in the constructor of the windows service.
so when exactly would you need a installer.

thanks
siddharth

Jul 21 '05 #4

P: n/a
Sidd,
In addition to the other comments.

The installer for a Windows Service will install the Windows Service itself,
allowing you to start it in the first place.

I would recommend using Installers for the custom event log & performance
counters, as the account that the service runs under may not be authorized
to create event logs & performance counters.

Also the Windows Service itself has a "default" event log that it may use
before OnStart or your code has a chance to execute.

Hope this helps
Jay

"sidd" <si************@hotmail.com> wrote in message
news:af*************************@posting.google.co m...
Hi All,
i have some doubts on .net windows services..
please see if some one could help me understand this..

1)is it possible to install a windows service which does not have a
installer added to it,
using installutil.exe

OR
is it must to have an installer to the service project to be able to
install it using installutil.exe

2)why exactly do you have to add installer to a
.net windows service project .
some of the samples i saw were for creating a custom event log ,or for
performance counter ..but it should be possible to do all this even
in the "OnStart" or in the constructor of the windows service.
so when exactly would you need a installer.

thanks
siddharth

Jul 21 '05 #5

P: n/a
I don't think you would need the installer if you want to add all the
proper entries into the registry (under
HKEY_LOCAL_MACHINE\system\currentcontrolset\servic es). Also, the
system account does have permissions to create
Its own source and log name, in our services we have our own log name
other than the Application logs.
Michael
On Mon, 19 Jul 2004 10:34:57 -0500, "Jay B. Harlow [MVP - Outlook]"
<Ja************@msn.com> wrote:
Sidd,
In addition to the other comments.

The installer for a Windows Service will install the Windows Service itself,
allowing you to start it in the first place.

I would recommend using Installers for the custom event log & performance
counters, as the account that the service runs under may not be authorized
to create event logs & performance counters.

Also the Windows Service itself has a "default" event log that it may use
before OnStart or your code has a chance to execute.

Hope this helps
Jay

"sidd" <si************@hotmail.com> wrote in message
news:af*************************@posting.google.c om...
Hi All,
i have some doubts on .net windows services..
please see if some one could help me understand this..

1)is it possible to install a windows service which does not have a
installer added to it,
using installutil.exe

OR
is it must to have an installer to the service project to be able to
install it using installutil.exe

2)why exactly do you have to add installer to a
.net windows service project .
some of the samples i saw were for creating a custom event log ,or for
performance counter ..but it should be possible to do all this even
in the "OnStart" or in the constructor of the windows service.
so when exactly would you need a installer.

thanks
siddharth


Jul 21 '05 #6

P: n/a
Michael,
That's the key word, if you want to add the proper entries into the
registry. I question why would I want to add all the proper entries myself,
when the InstallerUtil knows what they are by virtue of using reflection to
call the System.ServiceProcess.ServiceProcessInstaller class.

The Service itself cannot do it, as it can't run as a Service without them
(chicken & egg problem).

You're assuming the Service is running under the system account, Services do
not have to run under the service account!

Otherwise you are correct.

If you really don't want to use InstallUtil.exe, I would create my own
InstallUtil that did the same thing, use reflection to find all the
Installer attributes, creating an instance of them and invoking the
methods...

Hope this helps
Jay

"Michael" <ma*********@pparadise.biz> wrote in message
news:1p********************************@4ax.com...
I don't think you would need the installer if you want to add all the
proper entries into the registry (under
HKEY_LOCAL_MACHINE\system\currentcontrolset\servic es). Also, the
system account does have permissions to create
Its own source and log name, in our services we have our own log name
other than the Application logs.
Michael
On Mon, 19 Jul 2004 10:34:57 -0500, "Jay B. Harlow [MVP - Outlook]"
<Ja************@msn.com> wrote:
Sidd,
In addition to the other comments.

The installer for a Windows Service will install the Windows Service itself,allowing you to start it in the first place.

I would recommend using Installers for the custom event log & performance
counters, as the account that the service runs under may not be authorizedto create event logs & performance counters.

Also the Windows Service itself has a "default" event log that it may use
before OnStart or your code has a chance to execute.

Hope this helps
Jay

"sidd" <si************@hotmail.com> wrote in message
news:af*************************@posting.google.c om...
Hi All,
i have some doubts on .net windows services..
please see if some one could help me understand this..

1)is it possible to install a windows service which does not have a
installer added to it,
using installutil.exe

OR
is it must to have an installer to the service project to be able to
install it using installutil.exe

2)why exactly do you have to add installer to a
.net windows service project .
some of the samples i saw were for creating a custom event log ,or for
performance counter ..but it should be possible to do all this even
in the "OnStart" or in the constructor of the windows service.
so when exactly would you need a installer.

thanks
siddharth

Jul 21 '05 #7

P: n/a
thanks all.
-siddharth
Jul 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.