本文介绍了使用Process.Start和UAC在.NET中模拟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Process.Start(System.Diagnostics)方法的模拟选项从另一个需要提升的.NET程序中运行程序.模拟用户是本地管理员.操作系统是2008,UAC已打开.每当调用进程启动时,我都会收到Win32权限错误:

I am trying to run programs from another .NET program that requires elevation using the impersonation option of the Process.Start (System.Diagnostics) method. The user for impersonation is a local administrator. The O/S is 2008 and UAC is turned on.Whenever calling process start I'm getting a Win32 permission error:

请求的操作需要海拔"

"The requested operation requires elevation"

推荐答案

如果在app.manifest中正确配置了您正在调用的.NET应用程序,则无需在Process.Start调用中指定任何内容- UAC将自动显示.

If the .NET application you are calling is configured properly in the app.manifest, you don't have to specify anything in the Process.Start call - the UAC will appear automatically.

app.manifest设置:

app.manifest setting:

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

这篇关于使用Process.Start和UAC在.NET中模拟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 06:37