启用 UAC 时,能否将 ASP.NET 配置为以管理员身份运行?
我似乎找不到任何信息表明 ASP.NET 是否可以配置(通过 web.config 或 machine.config)以在启用了 UAC 的计算机上以真正管理员身份运行。
我的意思是,即使您将其设置为模拟管理员帐户,UAC 也会通过返回隐藏管理员角色的令牌集来禁用该帐户充当管理员的能力。对于 IsInRole 等任何检查,运行帐户实际上根本不是管理员。
所以...假设我想忽略所有好的建议,直接在 Vista 上以管理员权限运行一个 Web 应用程序。有可能吗?
欢迎替代方案。 (需要管理员权限的核心原因:停止或启动该计算机上运行的服务。)
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.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
核心原因的替代建议:
使用消息队列或类似的概念来传输有关服务的信息,以便在不同的安全上下文之间来回启动/停止,而不是尝试在 ASP.NET 下将这些内容硬连接在一起。
例如,
在您的 ASP.NET 非管理员帐户下,将一些值写入文件或注册表(某种日志),其中包含有关要停止或启动哪些服务的信息。
作为真正的管理员运行的控制器服务会轮询写入的数据位置,当它看到信息时,就会按照这些命令启动和停止相应的服务。
您可以通过解决方法来解决该问题,而不是采用安全黑客手段,或者完全禁用 UAC。
监视更新:
问题是,如果主/控制器服务停止并且没有报告任何内容(日志/消息停止传递)。如果可以的话,为该服务创建一个特殊情况,告诉 Windows 在它停止时重新启动它,或者在无法启动该服务时重新启动计算机......
顺便说一下,您是否研究过 Windows自动监视服务并在失败时重新启动服务的工具,而不是使用网页监视器,或者这不符合您的要求?
An alternate suggestion for Core Reason:
Use a message queue or similar concept to shuttle the information about services to start/stop back and forth between different security contexts instead of trying to hardwire those things together under ASP.NET.
For example,
Under your ASP.NET non-administrator account, write some values to file or registry (a log of some kind) that contain information about what services to stop or start.
Your controller service running as a true admin polls the written data location and when it sees info, follows those commands to start and stop the appropriate services.
You get around the problem with a workaround instead of a security hack, or instead of disabling UAC altogether.
Update for monitoring:
The problem is if that main/controller service stops and nothing gets reported (logs/messages stop being passed). Make a special case for that one service, if you can, by telling Windows to restart it if it stops, or to reboot the machine if it can't start that service ...
.. By the way, have you looked into Windows tools to automatically watch services and restart them on failure, instead of using a web page monitor, or is that not feasible for your requirements?