I am developing an application that runs as a windows service. I really need the service to have administrator privileges. I tried with the LocalSystem user, and it does not have enough rights. Is this possible? I tried setting requireAdministrator in the app.config. When I do this, the service starts and then immediately stops. I have tried with other administrator accounts as well, but I get the same results.
Run service with administrator privileges
Asked Answered
The problem was that I was adding the requireAdministrator in the app.config not the app.manifest. Once I got it in the right place, everything worked like it was supposed to. –
Millsaps
You just need to run it as an admin user - set the login correctly in the services properties for the service.
Usually though it's best to run as an ordinary user and give it explicit permissions to the resources it needs access to.
Thank you. I figured out what I was doing wrong, see my comment above. How would I go about giving explicit permissions? This is the first time I have really needed to change the permissions in the manifest. I can do some research, just figured helpful tips on where to get started are always nice. The reason I need admin privileges is that I require direct drive access to some drives. –
Millsaps
It depends what you're trying to access - LocalSystem is an administrator service account anyway, so it should already have permissions to local drives. –
Southland
© 2022 - 2024 — McMap. All rights reserved.