BAD_SEED
BAD_SEED

Reputation: 5056

From vb.NET console application to Windows service

I have a Console Appplication in Visual Basic, now I want to translate it in a Windows service. How can I do that? I have choose Project->Properties and then I have selected Windows Service from the drop down menu, but isn't enough, since something is missing (propably an installer?).

What's the complete procedure?

Upvotes: 2

Views: 2507

Answers (1)

Matt Wilko
Matt Wilko

Reputation: 27322

Have a look at this page: Walkthrough: Creating a Windows Service Application in the Component Designer

Specifically the Section "Create Installers for your Service:"

  1. In Solution Explorer, right-click Service1.vb or Service1.cs and select View Designer.
  2. Click the background of the designer to select the service itself, instead of any of its contents.
  3. With the designer in focus, right-click, and then click Add Installer. By default, a component class that contains two installers is added to your project. The component is named ProjectInstaller, and the installers it contains are the installer for your service and the installer for the service's associated process.
  4. In Design view for ProjectInstaller, click ServiceInstaller1 for a Visual Basic project, or serviceInstaller1 for a Visual C# project.
  5. In the Properties window, make sure the ServiceName property is set to MyNewService.
  6. Set the StartType property to Automatic.
  7. In the designer, click ServiceProcessInstaller1 for a Visual Basic project, or serviceProcessInstaller1 for a Visual C# project. Set the Account property to LocalSystem. This will cause the service to be installed and to run on a local service account.

Upvotes: 1

Related Questions