简体   繁体   English

如何在C#中没有管理员权限的情况下重新启动IIS

[英]How To Restart IIS without Admin Rights in C#

在用户没有管理员权限的情况下,C#应用程序需要什么代码才能重新启动用户的IIS?

I don't think it's possible through code alone (and if it was, it'd be an exploit.) 我认为仅通过代码是不可能的(如果可以的话,这将是一种利用。)

You'd need to write a daemon that ran as a privileged user that accepted restart commands from unprivileged sources, say by checking for the existence of a lockfile or similar, or accepting commands over a socket, and then restarted the server accordingly. 您需要编写一个以特权用户身份运行的守护程序,该守护程序接受来自非特权源的重启命令,例如,通过检查是否存在锁定文件或类似文件,或者通过套接字接受命令,然后相应地重启服务器。

Which would be a serious security risk, still, but whatever floats your boat. 但这仍然是一个严重的安全隐患,但无论您的船身如何漂浮。

It still might be better to think hard about why you want to do this. 努力思考为什么要这样做仍然更好。 I think you'll find that whatever criteria prevent you from making the relevant user an IIS admin are excellent arguments for why the user shouldn't be rebooting IIS either. 我想您会发现,无论什么条件阻止您使相关用户成为IIS管理员,这都是为什么用户也不应该重新启动IIS的绝佳论据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM