C#UAC麻烦-摆脱可怕的UAC窗口... [英] C# UAC woes - getting rid of the dreaded UAC window...

查看:185
本文介绍了C#UAC麻烦-摆脱可怕的UAC窗口...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力在没有UAC弹出窗口的情况下加载我的应用程序.我的应用程序确实需要管理员权限,因为我要在本地以及2008服务器上的域中管理用户帐户.我的应用程序分为两个部分,一个服务和一个控制该服务的WPF应用程序.

我从Comodo购买了开发者证书,并且能够对应用程序进行签名.我也有一个分配给该项目的.manifest文件.

构建应用程序后,我看到了屏蔽,因此我知道它可以正常工作.但是,当我单击它时,会出现一个蓝色窗口,询问是否要允许以下程序对此计算机进行更改.

我相信我的问题围绕这条线:

I''m struggling to get my application to load without having a UAC popup window. My application does require admin access as I''m managing user accounts locally and with the domain on a 2008 server. My application is two parts, a service and a WPF app that controls the service.

I purchased a developer cert from Comodo and am able to sign the application. I also have a .manifest file assigned to the project.

After I build the application I see the shield on it so I know it''s working ok. However, when I click on it I get a blue window asking if I want to allow the following program to make changes to this computer.

I believe my issue is around this line:

<requestedexecutionlevel level="requireAdministrator" uiaccess="false" />



如果将级别设置为asInvoker,则不会出现UAC窗口,但由于需要操作,我的应用程序已关闭.



If I set the level to asInvoker the UAC window doesn''t appear but my app shuts down because of what it needs to operate.

Does anyone know how I can around this issue without disablign UAC?

推荐答案

您无法摆脱UAC窗口.

激活UAC后,任何管理员帐户都将在没有管理员特权的情况下运行,直到实际需要它们为止. Windows做出确定后,将出现UAC提示窗口.

对于您的应用程序,您无能为力.由用户管理员决定是否要关闭UAC或将其设置为其他级别的策略.
You can''t get rid of the UAC window.

When UAC is activated, any admin account will run WITHOUT admin priv''s until they are actually needed. When that determination has been made by Windows, the UAC prompt window appears.

There''s nothing you can do about it for your application. it''s up to the user''s admins to turn off UAC or set it to some other level in policy.


您可以添加 ^ ]标识该程序的特权.
将文件另存为ApplicationName.exe.manifest.
You can add a manifest to the application[^] that identifies the privileges for that program.
Save the file as ApplicationName.exe.manifest.


我确实已成功应用了清单.如果我将清单中的行从requireAdministrator更改为asInvoker,则窗口将消失.但是我的应用程序无法运行,因为它需要管理员执行.顺便说一句,戴夫(Dave),我正在尝试对您提到的内容进行更多阅读.谢谢.
I do have a successful manifest being applied. If I change the line in the manifest from requireAdministrator to asInvoker the window goes away. But my app will not run because it requires administrator to do so. BTW Dave, I''m attempting to do more reading on what you have mentioned. Thanks.


这篇关于C#UAC麻烦-摆脱可怕的UAC窗口...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆