以管理员权限运行服务[英] Run service with administrator privileges

本文是小编为大家收集整理的关于以管理员权限运行服务的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我正在开发作为Windows服务运行的应用程序.我真的需要服务来拥有管理员权限.我尝试使用localsystem用户,它没有足够的权利.这可能吗?我尝试在app.config中设置receleadministrator.当我这样做时,服务开始然后立即停止.我也试过其他管理员帐户,但我得到了相同的结果.

推荐答案

您只需要将其运行为管理员用户 - 在服务的服务属性中正确设置登录.

通常最好运行作为普通用户,并为其需要访问的资源提供显式权限.

本文地址:https://www.itbaoku.cn/post/1938247.html

问题描述

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.

推荐答案

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.