以管理员权限运行服务

编程入门 行业动态 更新时间:2024-10-09 12:35:41
本文介绍了以管理员权限运行服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在开发一个作为 Windows 服务运行的应用程序.我真的需要该服务具有管理员权限.我尝试使用 LocalSystem 用户,但它没有足够的权限.这可能吗?我尝试在 app.config 中设置 requireAdministrator.当我这样做时,服务启动然后立即停止.我也尝试过使用其他管理员帐户,但结果相同.

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.

这篇关于以管理员权限运行服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-17 22:53:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/923585.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:管理员权限

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!