0

I can't seem to find any information that indicates whether ASP.NET can be configured (through web.config or maybe machine.config) to run as a real administrator on a machine with UAC enabled.

By this I mean, even if you set it to impersonate an Administrator account, UAC will disable that account's ability to act as an Administrator by returning a token set that hides the administrator role. For any checks such as IsInRole, the running account is effectively not an administrator at all.

So ... Let's say I want to ignore all good advice and just go ahead and run a web app on Vista with administrator permissions. Is it even possible?

Alternatives welcome. (Core reason for needing administrator privileges: to stop or start services that are running on that machine.)

4

1 回答 1

1

核心原因的另一个建议:

使用消息队列或类似概念来传递有关服务的信息以在不同的安全上下文之间来回启动/停止,而不是尝试在 ASP.NET 下将这些东西硬连接在一起。

例如,

  1. 在您的 ASP.NET 非管理员帐户下,将一些值写入文件或注册表(某种日志),其中包含有关停止或启动哪些服务的信息。

  2. 作为真正的管理员运行的控制器服务会轮询写入的数据位置,当它看到信息时,按照这些命令启动和停止相应的服务。

您可以通过解决方法而不是安全黑客来解决问题,或者完全禁用 UAC。

监控更新:

  1. 与上面相同的想法,但有些相反 - 在系统上运行的此场景的主/控制器服务写入日志文件。它是写其他服务的服务。
  2. 在网页上设置自动刷新。每次您的网页刷新时,它都会查看更改日志 = 有关已停止或启动的服务的信息(可以保留自己的暂存文件以进行更改检测)。刷新可能是 META Refresh 标记,或者是对服务器的 AJAX 回调(更微妙)。
  3. 网页像以前一样发出指令。

问题是如果该主/控制器服务停止并且没有任何报告(日志/消息停止传递)。如果可以的话,为那个服务做一个特殊情况,告诉 Windows 如果它停止就重新启动它,或者如果它不能启动那个服务就重新启动机器......

.. 顺便说一下,您是否研究过 Windows 工具来自动监视服务并在出现故障时重新启动它们,而不是使用网页监视器,或者这对您的要求不可行?

于 2010-03-11T03:39:40.587 回答