windows service... when do we need installer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sidd

    windows service... when do we need installer

    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
  • Guy LaRouche

    #2
    Re: windows service... when do we need installer

    sidd wrote:
    [color=blue]
    > 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[/color]

    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.
    [color=blue]
    >
    > 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.[/color]

    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.
    [color=blue]
    >
    > thanks
    > siddharth[/color]

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

    Comment

    • Kevin Yu [MSFT]

      #3
      Re: windows service... when do we need installer

      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
      misunderstandin g, 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:


      frlrfSystemServ iceProcessServi ceInstallerClas sTopic.asp

      HTH.

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

      Comment

      • Nick Malik

        #4
        Re: windows service... when do we need installer

        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" <siddharthkhare @hotmail.com> wrote in message
        news:af96a2d7.0 407182109.22215 98@posting.goog le.com...[color=blue]
        > 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[/color]


        Comment

        • Jay B. Harlow [MVP - Outlook]

          #5
          Re: windows service... when do we need installer

          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" <siddharthkhare @hotmail.com> wrote in message
          news:af96a2d7.0 407182109.22215 98@posting.goog le.com...[color=blue]
          > 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[/color]


          Comment

          • Michael

            #6
            Re: windows service... when do we need installer

            I don't think you would need the installer if you want to add all the
            proper entries into the registry (under
            HKEY_LOCAL_MACH INE\system\curr entcontrolset\s ervices). 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]"
            <Jay_Harlow_MVP @msn.com> wrote:
            [color=blue]
            >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" <siddharthkhare @hotmail.com> wrote in message
            >news:af96a2d7. 0407182109.2221 598@posting.goo gle.com...[color=green]
            >> 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[/color]
            >[/color]

            Comment

            • Jay B. Harlow [MVP - Outlook]

              #7
              Re: windows service... when do we need installer

              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.ServiceP rocess.ServiceP rocessInstaller 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" <mastrauckas@pp aradise.biz> wrote in message
              news:1p4qf0lr0d 9jutbopbu2gk0it cl28f3dnr@4ax.c om...[color=blue]
              > I don't think you would need the installer if you want to add all the
              > proper entries into the registry (under
              > HKEY_LOCAL_MACH INE\system\curr entcontrolset\s ervices). 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]"
              > <Jay_Harlow_MVP @msn.com> wrote:
              >[color=green]
              > >Sidd,
              > >In addition to the other comments.
              > >
              > >The installer for a Windows Service will install the Windows Service[/color][/color]
              itself,[color=blue][color=green]
              > >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[/color][/color]
              authorized[color=blue][color=green]
              > >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" <siddharthkhare @hotmail.com> wrote in message
              > >news:af96a2d7. 0407182109.2221 598@posting.goo gle.com...[color=darkred]
              > >> 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[/color]
              > >[/color]
              >[/color]


              Comment

              • sidd

                #8
                Re: windows service... when do we need installer

                thanks all.
                -siddharth

                Comment

                Working...