Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to run WebListener as a Windows service #9

Open
cofonseca opened this issue Oct 12, 2017 · 8 comments
Open

Add the ability to run WebListener as a Windows service #9

cofonseca opened this issue Oct 12, 2017 · 8 comments

Comments

@cofonseca
Copy link
Owner

I'd like to figure out how to allow WebListener to run as a Windows service, so that it could be started and left to run in the background without a user needing to be logged in.

Interested in any ideas or feedback that anyone might have on how to accomplish this.

@CodeBarbarian
Copy link

Hi @cofonseca, I have a couple of ideas on how to get your WebListener running as a Windows Service. I will see what I can do when I get home.

@CodeBarbarian
Copy link

I found an article on https://msdn.microsoft.com/en-us/magazine/mt703436.aspx

I will see what I can do with it in the following week.

@cofonseca
Copy link
Owner Author

Excellent @CodeBarbarian , thanks! No rush on this at all - it's a pretty low priority for me.

I came across the same article a few days ago but haven't really had time to dig into it. I'm very interested to see what you come up with. Feel free to reach out if there's anything I can assist with.

@CodeBarbarian
Copy link

CodeBarbarian commented Oct 18, 2017

I tried using the NSSM at http://nssm.cc/

Start-Process -FilePath .\nssm.exe -ArgumentList 'install YourServiceNameHere "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-command "& { . C:\Scripts\WebListener\Start-WebListener.ps1; Start-WebListener }"" ' -NoNewWindow -Wait

It works.

NSSM is a service helper that could do exactly what you need. If you rather would like to add legacy service support, it would be by using the article mentioned in the comment from msdn.

@cofonseca
Copy link
Owner Author

Awesome. I'll give it a try this weekend and see how it works out.

What do you think would be the better solution long-term in regards to someone using WebListener for a small project? Downloading NSSM and getting it set up doesn't seem to be difficult, but would take a few extra steps for a user who wanted to use WebListener as a service. Legacy service support would take more work up-front, but would make WebListener easier to use going forward.

I'll try to do a bit more research this weekend but maybe we just add some documentation on how to use this with NSSM in the meantime, and shoot for service support in the future. Thoughts?

@CodeBarbarian
Copy link

Optionally we could try using the New-Service Cmdlet in Powershell?

@al-ign
Copy link
Contributor

al-ign commented Nov 24, 2017

Optionally we could try using the New-Service Cmdlet in Powershell?

You still need to have ServiceManagement functions, for the OS to recognize it as 'service'

NSSM is a great tool, but if you don't want to use it (or can't for any reason), you can have almost 'service'-like experience with Task Scheduler. You will only miss service management functions.

@RobWoods-CPG
Copy link

Another option would be to start the powershell script from task scheduler when the computer starts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants