gpt4 book ai didi

c# - ServiceController 关闭 IIS 安全访问

转载 作者:可可西里 更新时间:2023-11-01 10:30:29 26 4
gpt4 key购买 nike

我正在使用 ServiceController 类从 C# 程序集远程关闭 IIS。我想知道我需要通过网络执行此操作的最低级别的权限是什么,在我当前的测试中我使用的是 Administrator 并且它工作正常,但是当我迁移到 Production 时我将使用 AD 组并且需要提供它是正确的安全级别吗?

           // Make a call to IIS to shutdown the service. 
ServiceController sc = new ServiceController(serviceName, serverName);

//Can we stop the service
if (sc.CanStop)
{
//Stop it
sc.Stop();
}

干杯,康纳

最佳答案

Windows 服务由访问控制列表 (ACL) 保护。这些与用于保护文件、目录、注册表项等的文件访问控制列表相同。

如果您的 AD 用户对您控制的服务还没有足够的权限,您需要安排在部署到生产之前(或作为其一部分)授予适当的权限(即 SERVICE_STOP)。

命令行工具,例如 SUBINACL可用于操作 Windows 服务上的 ACL。

关于c# - ServiceController 关闭 IIS 安全访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1946720/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com