【发布时间】:2011-12-17 20:23:15
【问题描述】:
我有一个方法,想用具有管理员权限的新线程运行它,
[PrincipalPermission(SecurityAction.Demand, Role = @"BUILTIN\Administrators")]
void Install()
{
//do some thing
}
我是这样运行的,
installerTh = new Thread(new ThreadStart(Install));
installerTh.Name = "Installer";
installerTh.Start();
但它给了我错误
System.Security.SecurityException 未处理
Message=请求主体权限失败。
在运行此线程之前显示 UAC 窗口的任何想法? (或在运行过程中)
【问题讨论】:
-
你见过这个问题吗:stackoverflow.com/questions/17533/…
-
嗨丹尼尔,他们解释了如何启动新的特权进程,我想为我当前正在运行的线程或进程授予特权。