Windows service does not appear in the list of services after installation

I created a Windows service in C # using Visual Studio 2008 I pretty much followed this: http://www.codeproject.com/KB/dotnet/simplewindowsservice.aspx

I created the installation project, as indicated in the article, and launched it ... it installs my service in c: \ program files \ product, etc .... however, it does not appear in the list of services.

What am I missing?

+53
c # visual-studio-2008 windows-services setup-deployment
Oct 13 '09 at 13:54
source share
8 answers

The most important part of the article you linked is here.

To add a custom action to the installation project

1. In Solution Explorer, right-click the installation project, select View, and then select Custom Actions. Custom An action editor will appear.

2. In the custom action editor, right-click the custom node actions and select Add Custom Action. Select an item in the Project dialog box appears.

3. Double-click the application folder in the list to open it, select the primary output from MyNewService (Active), and click OK. The main output is added to all four nodes with the user actions Set, Commit, Rollback and Uninstall.

4.Build installation project.

If you skip these steps, your installation project will create and copy your files to the correct directory; however, they will not register your binary as a service without these steps.




It should also be noted that this works for older versions of Visual Studio that had / had a built-in installation / deployment project template. Newer versions of Visual Studio have different installation / deployment projects (some of them require third-party software.)

I would recommend looking at the WiX Toolset and checking out WiX Installing Windows Services here .

+104
Oct 13 '09 at 14:08
source share

I came across this face, so I put it here just in case someone else comes across this.

If you follow the instructions in the manuals but still have installation problems, make sure your Installer class is public. Internal mode will not work.

+6
Mar 11 '10 at 20:12
source share

I had the same problem and realized that I never set the parent element for ServiceInstaller.

Double click on the project installer. The designer should show the service installer and the process installer. When you click on and view properties, you must consider the Parent attribute, which should be set as the class name of the Project installer.

Or, if you do this in code, make sure you install:

serviceInstaller.Parent = this; 

and

 serviceProcessInstaller.Parent = this; 
+6
Jul 18 '11 at 12:13
source share

When installing services, I highly recommend using NSSM , which worked fine for me for all my WinService needs. It can install any executable file (even if .bat, .cmd) as a service and ensures that your service always works and works.

To use this tool:

  • Download here

  • And follow the instructions here

Then check the list of services, it should be there, up and running.

+3
Jan 30 '14 at 21:41
source share

Follow these instructions, they worked for me. For installation, this part is specifically at the bottom of the article.

MSDN: Walkthrough: Creating a Windows Service

+1
Oct 13 '09 at 2:00
source share

In Visual Studio 2013, I ran into the same problem using the InstallShield template for a service application. But it works like a charm when using the Project Project template https://visualstudiogallery.msdn.microsoft.com/9abe329c-9bba-44a1-be59-0fbf6151054d

so download the Setup Project template, close your studio, run this installation and run your Studio, it will work.

Dunn.

0
Jun 12 '15 at 15:06
source share

Here is a good tutorial from tgeek001 from CodeProject.com that helped me. It includes several things that I have not seen in the posts above: 1. Event handler code to stop the service before deleting it. 2. Specific conditions and properties in the user action code to prevent crashes (they fixed error 1001, which I experienced following the instructions in the accepted answer above) 3. Win Service utility: "Delete previous version" set to true

http://www.codeproject.com/Tips/575177/Window-Service-Deployment-using-VS

The following is a guide to customizing user actions (questions):

  • Set, set the Condition property to the following: "NOT (Installed or PREVIOUS FAULT)"
  • Remove, set the Condition property to the following: "NOT UPGRADINGPRODUCTCODE"
  • Commit: set the "Custom Action Data" field to: / OldProductCode = "[PREVIOUSVERSIONSINSTALLED]"

Finally, in the WinService project, make sure the “Delete Previous Versions” drop-down menu is true.

amuses

0
Sep 28 '15 at 13:32
source share

I found that your installer class is in the same project as the Service. The installer cannot exist in the library project referenced by the Service.

0
Aug 28 '17 at 18:55
source share



All Articles