Node.js Application as a Windows Service (With registry fix)

npm install

npm install

In my case, command nssm install MyWebService… was unsuccessful, the problem was that app.js can’t find config.json file.

First you will need:

  1. Node.js application (project) which you want to run as a Windows Service
  2. Node.js
  3. NSSM

1 step: Set your Node.js application as Windows Service

Download nssm.exe and put file into you node.js project folder

Put nssm.exe file into you node.js project folder

Put nssm.exe file into you node.js project folder

Run Windows Command Processor (cmd.exe) as administrator and go to your node.js project folder

Your node.js project folder

Your node.js project folder

Run command npm install

npm install

npm install

Run command node src\app.js and allow access through Windows firewall

Allow access through Windows firewall

Allow access through Windows firewall

 

Run these two commands
nssm.exe install MyWebService "C:\Program Files\nodejs\node.exe" "C:\Service\src\app.js"
net start MyWebService

net start MyWebService

net start MyWebService

Now we need to fix this error.

2 step: Edit registry

Open registry editor (regedit.exe) and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MyWebService\Parameters

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MyWebService\Parameters

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MyWebService\Parameters

Now we need to change AppDirectory from C:\Program Files\nodejs to C:\Service

Change AppDirectory from C:\Program Files\nodejs to C:\Service

Change AppDirectory from C:\Program Files\nodejs to C:\Service

Restart computer and don’t forget to run Apache, MySQL or any other necessary servers for your project after restart.

Node.js Application as a Windows Service

Node.js Application as a Windows Service

Parašė Gediminas Deveikis Data 2013-07-29
Žymės: , , , , ,

Komentarai

God bless you, dude. Thanks a lot!

asd [2014-05-06 14:01]

Kategorijos

Įrašų archyvo kalendorius

2017 m. rugsėjo mėn.
P A T K P Š S
« Geg    
 123
45678910
11121314151617
18192021222324
252627282930