Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Couple of questions regarding Windows Service in C#

Couple of questions regarding Windows Service in C#

Scheduled Pinned Locked Moved C#
questioncsharp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aryan S
    wrote on last edited by
    #1

    Hi, I am developing a Windows service in C#. I have couple of question on that. 1. Is it possible to set a Start up parameter during installation of the service? I know that I can pass a parameter while calling ServiceController.Start() method. But the service start type is Autometic and I want the service to run everytime with the same parameter. 2. Is it possible to uninstall the service from within. Say if I meet certain criteria in the service work flow, I want to uninstall the service. Is it possible? Thanks.

    D P 2 Replies Last reply
    0
    • A Aryan S

      Hi, I am developing a Windows service in C#. I have couple of question on that. 1. Is it possible to set a Start up parameter during installation of the service? I know that I can pass a parameter while calling ServiceController.Start() method. But the service start type is Autometic and I want the service to run everytime with the same parameter. 2. Is it possible to uninstall the service from within. Say if I meet certain criteria in the service work flow, I want to uninstall the service. Is it possible? Thanks.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Aryan S wrote:

      1. Is it possible to set a Start up parameter during installation of the service? I know that I can pass a parameter while calling ServiceController.Start() method. But the service start type is Autometic and I want the service to run everytime with the same parameter.

      Store the parameters in the Registry or in a config file somewhere.

      Aryan S wrote:

      2. Is it possible to uninstall the service from within. Say if I meet certain criteria in the service work flow, I want to uninstall the service. Is it possible?

      I've never heard of a service uninstalling itself. Doesn't mean it's not possible though.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008
      But no longer in 2009...

      1 Reply Last reply
      0
      • A Aryan S

        Hi, I am developing a Windows service in C#. I have couple of question on that. 1. Is it possible to set a Start up parameter during installation of the service? I know that I can pass a parameter while calling ServiceController.Start() method. But the service start type is Autometic and I want the service to run everytime with the same parameter. 2. Is it possible to uninstall the service from within. Say if I meet certain criteria in the service work flow, I want to uninstall the service. Is it possible? Thanks.

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3
        1. Store it somewhere -- I use a database 2) I doubt it; you can't uninstall a running Service ... but maybe you could Start a Process that will stop and uninstall the Service.
        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups