如何授予我的 C# 应用程序管理权限?清单文件
我在使用使用 win32_networkingadapterconfig 的 C# 应用程序时遇到一些问题。问题是,当我在没有管理员权限的用户上使用该应用程序时,我无法使用 win32_networkingadapterconfig 中的更改功能。我尝试过“以管理员身份运行”,但没有成功。我尝试在 trustInfo 部分中使用此内容制作一个清单文件:
<security>
<applicationRequestMinimum>
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
<defaultAssemblyRequest permissionSetReference="Custom" />
</applicationRequestMinimum>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
启用 clickone 安全设置设为完全信任。我做错了什么?
I'm having some trouble with my C# app that uses win32_networkingadapterconfig. The problem is that I can't use the altering functions in win32_networkingadapterconfig when I use the app on a user that dont have admin rights. I have tried to "run as administrator", but no luck. And I have tried to make a manifestfile with this content in the trustInfo part:
<security>
<applicationRequestMinimum>
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
<defaultAssemblyRequest permissionSetReference="Custom" />
</applicationRequestMinimum>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
Enable clickone security settings are set to full trust. What am I doing wrong ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的代码片段中有一个“trustinfo”。让它看起来像这样:
There's a "trustinfo" dangling in your snippet. Make it look like this:
我按照我怀疑最有可能的顺序列出了许多可能的问题。
可能的问题1
你的UAC设置是什么?如创建并嵌入应用程序清单 (UAC) 中详细介绍的
如果您禁用了 UAC 并且您请求管理员权限
可能的问题 2
由于需要程序集信息,清单中的其他位置可能有问题。发布您的整个清单会有所帮助。
可能的问题3
您已添加 UAC 升级不需要的
applicationRequestMinimum
节点。也许值得放弃它并再次尝试。There are a number of possible issues which I have listed in the order I suspect is most likely to less likely.
Possible Problem 1
What are your UAC settings? As detailed in Create and Embed an Application Manifest (UAC)
if you have UAC disabled and you request administrator permissions the
Possible Problem 2
There could be something wrong else where in the manifest as the assembly information is required. Posting your whole manifest would help.
Possible Problem 3
You have added the
applicationRequestMinimum
node which is not required for UAC escalation. It may be worth dropping that and trying again.