Appendix
Earlier in this chapter, we showed you how to install a Windows service on your development machine. This approach was a simplified method that might not work for environments outside your machine. So, here is a more advanced way of configuring an app as a Windows service.
Installing your app as a Windows service – the advanced method
For production use, it is likely that permissions are more fine-grained and locked down. Perform the following steps instead to set up an app as a service:
- Log on to the Windows server where you will deploy the service.
- Open a PowerShell prompt, and run the following command:
New-LocalUser -Name dotnetworker
. - You need to grant permissions to the service account you just created in order to enable it to start the services. Follow these steps:
a. Open the Local Security Policy editor by running
secpol.msc
.b. Expand the Local Policies node and select
User Rights Assignment
.c. Open the Login as a service policy.
d. Select...