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. Visual Basic
  4. Windows Service Automatic Start

Windows Service Automatic Start

Scheduled Pinned Locked Moved Visual Basic
csharpquestion
3 Posts 2 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.
  • T Offline
    T Offline
    Todd_S
    wrote on last edited by
    #1

    I am developing a windows service in VB .NET. I currently am using a START button on a windows form (separate application) to start the service. I would like to avoid having a separate application and, instead, have the service automatically start at installation. Does anyone know how I might accomplish this? Thanks for your time.

    B 1 Reply Last reply
    0
    • T Todd_S

      I am developing a windows service in VB .NET. I currently am using a START button on a windows form (separate application) to start the service. I would like to avoid having a separate application and, instead, have the service automatically start at installation. Does anyone know how I might accomplish this? Thanks for your time.

      B Offline
      B Offline
      Barathan
      wrote on last edited by
      #2

      hi my dear friend, always Try avoiding a user interface, inputs and message boxes in the service application or for starting the service. To make your service to start Automatically during the start up of windows in the serviceinstaller Open the service.vb design window, right click on it and select Add Installer option, which will add an installer project (called ProjectInstaller.vb) with two controls -- ServiceProcessInstaller1 and ServiceInstaller1 -- to our existing project. Open ProjectInstaller.vb, select the ServiceInstaller1 control, and open the property window. Change the StartType property to automatic if you want to start the service automatically during the OS Start Up. HAPPY PROGRAMMING! ;) With regards, Barathan.K Barathan.K

      T 1 Reply Last reply
      0
      • B Barathan

        hi my dear friend, always Try avoiding a user interface, inputs and message boxes in the service application or for starting the service. To make your service to start Automatically during the start up of windows in the serviceinstaller Open the service.vb design window, right click on it and select Add Installer option, which will add an installer project (called ProjectInstaller.vb) with two controls -- ServiceProcessInstaller1 and ServiceInstaller1 -- to our existing project. Open ProjectInstaller.vb, select the ServiceInstaller1 control, and open the property window. Change the StartType property to automatic if you want to start the service automatically during the OS Start Up. HAPPY PROGRAMMING! ;) With regards, Barathan.K Barathan.K

        T Offline
        T Offline
        Todd_S
        wrote on last edited by
        #3

        Thanks for your reply. Actually, I do have the service automatically starting during the OS start-up using the method you described. What I want to do is have the service automatically started right after installation (without requiring a reboot). I was eventually able to accomplish this by putting the following code in the ProjectInstaller.vb file. The program "MyApp" is a console application that starts, stops, pauses, etc. the service using various command parameters (in this case, "/start,MyService"). 'Auto-start the service after installation. Dim psInfo As New System.Diagnostics.ProcessStartInfo("C:\Program Files\MyApp.exe", "/start,MyService") psInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden Dim myProcess As Process = System.Diagnostics.Process.Start(psInfo) Thanks, Todd_S

        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