node-windows icon indicating copy to clipboard operation
node-windows copied to clipboard

Service creation no error , Task Manager: Services does not show anything

Open MillerAaron opened this issue 9 years ago • 10 comments

The service looks like it was created as i have log records for the start of my node server. I do not see the Service within Task Manager: Services

PS C:\NodeApps\Cdsfeedt> node createService.js Service installed and is now starting up

{"level":"info","message":"Express server listening on port 9443","timestamp":"2015-08-24T12:36:49.801Z"}

Code that was used to create the service: (missing the details of the name and file location) File: createService.js

var Service = require('node-windows').Service;

// Create a new service object var svc = new Service({ name:'Name of service', description: 'lets put something here to help out the lookers', script: 'File patth') });

// Listen for the "install" event, which indicates the // process is available as a service. svc.on('install',function(){ svc.start(); });

svc.install();

MillerAaron avatar Aug 24 '15 13:08 MillerAaron

The file path may matter... this behavior can occur if you're attempting to launch the service in a privileged directory without admin rights (such as C:\Program Files).

coreybutler avatar Aug 24 '15 14:08 coreybutler

using the following path C:\NodeApps\ or are you referencing the path to the node exe?

MillerAaron avatar Aug 24 '15 15:08 MillerAaron

Ok i found one issue. You need to have C:\Node. So that was one of them. When running from command line no issues. When starting the Service it starts and then stops. Anywhere i can look to see what is happening?

here is the error: -g 0.25 -w 1 -r 3 -a n] terminated with 0 in the window event viewer

MillerAaron avatar Aug 24 '15 15:08 MillerAaron

I was referring to the directory where the application exists.

Have you seen the wiki? It may give you a starting point.

coreybutler avatar Aug 24 '15 16:08 coreybutler

Went through the Wiki page everything looks like it should. I have set the service to run as admin for time time being to see if helped. i know i don't have __dirname, it is hard code for the path

MillerAaron avatar Aug 24 '15 17:08 MillerAaron

I have seen this same behavior on Windows 10, but only the very first time a service is installed. I can completely remove all trace of the service and application, and it installs fine after that.

Using an absolute path did not resolve the issue.

ElsewhereGames avatar Dec 01 '15 18:12 ElsewhereGames

Looks like its the .NET 3.5 requirement. Once this is installed, the service starts normally.

In our installer, the installation process completes and attempts to install the service before the .NET 3.5 completes. However, no error is noted in the logs when this happens.

ElsewhereGames avatar Dec 01 '15 19:12 ElsewhereGames

I too have this issue, running Windows 10

GiovanniL19 avatar Mar 24 '16 10:03 GiovanniL19

Fixes it, the issue I had was related to the name of the service. So I renamed it to one word and it worked

GiovanniL19 avatar Mar 24 '16 12:03 GiovanniL19

FIX: I was receiving the following error: "An error occurred while parsing EntityName..." whenever I tried to run the .exe file in the daemon folder after successfully installing my service (I had to do a screenshot of my command prompt because the window opens and closes very quickly).

Turns out the description of my service contained the "&" symbol which is not valid in XML elements. I uninstalled the current service; then changed my service description and installed it again and it works as expected now. Avoid the following in your Service's name and description: " ' <

&

5iDS avatar May 21 '16 09:05 5iDS