I am using node-windows to run my node app as a service. Because I intend to use node-expose-sspi I created a service account with powershell (I checked with Test-ADServiceAccount).
If I run this code
var Service = require('node-windows').Service;
// Create a new service object
var svc = new Service({
name:'project-name',
description: 'node server',
script: 'C:\\server\\server.js'
, allowServiceLogon: true
// ,
// env:{
// name: "NODE_ENV",
// value: "production"
// }
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
});
// Just in case this file is run twice.
svc.on('alreadyinstalled',function(){
console.log('This service is already installed.');
});
// Listen for the "start" event and let us know when the
// process has actually started working.
svc.on('start',function(){
console.log(svc.name+' started!\nVisit http://127.0.0.1:5000 to see it in action.');
});
// Install the script as a service.
svc.install();
I get the console log 'project-name started...' but the service is not created (I checked with get-process). If I omit 'allowServiceLogon: true' the service is created.
How do I specify the service account in node-windows?