node.js http server as a Windows service

后端 未结 6 765
再見小時候
再見小時候 2021-02-01 21:42

I created a simple http server in Node.js.

I wanted to make it run permanently on my Windows 2008 machine, so that, if the computer reboots, it automatically restarts.

6条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-01 22:21

    As I recall, the Service runtime environment isn't the same as running something under the command shell. In particular, Services are required to respond to messages from the system to indicate their running status, as you've seen :-)

    This must be a solved problem, though...

    Sure enough: https://npmjs.org/package/windows-service

    windows-service

    Run Node.JS programs as native Windows Services.

    npm install windows-service

提交回复
热议问题