单击一次 + HKEY_LOCAL_MACHINE
我有一个用 .NET 4.0、VS2010 编写的 WPF 应用程序,我希望通过 clickonce 在我们的 Intranet 内部进行部署。
问题是我试图在 HKEY_LOCAL_MACHINE 中创建注册表项,但访问被拒绝。
我已将应用程序设置为完全信任,甚至尝试断言RegistryPermission但无济于事。
难道真的不可能通过 clickonce 分发应用程序并让它访问 HKEY_LOCAL_MACHINE 吗?
I have a WPF app written in .NET 4.0, VS2010 that I am looking to deploy via clickonce internally on our intranet.
The issue is that I am trying to create a registry key in HKEY_LOCAL_MACHINE, and I am getting access denied.
I have the app set for full trust, and even tried asserting the RegistryPermission to no avail.
Is it truly not even possible to distribute an app via clickonce and have it access HKEY_LOCAL_MACHINE?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ClickOnce 则不然。
请参阅此处进行讨论。相关部分:
由于应用程序面临安全提升攻击的风险,如果为客户端启用了 UAC,ClickOnce 应用程序无法请求权限提升。任何尝试将其requestedExecutionLevel 属性设置为requireAdministrator 或highestAvailable 的ClickOnce 应用程序都不会安装在Windows Vista 上。
最后一条语句也适用于Windows 7,因为安全模型相同。
最重要的是,您想要执行的操作需要提升到“以管理员身份运行”,所以不,您无法对已打开 UAC 的客户端执行您尝试执行的操作。
Not with ClickOnce.
See here for a discussion. Relevant part:
Due to the risk of exposing applications to security elevation attacks, ClickOnce applications cannot request permission elevation if UAC is enabled for the client. Any ClickOnce application that attempts to set its requestedExecutionLevel attribute to requireAdministrator or highestAvailable will not install on Windows Vista.
The last statement also applies to Windows 7, since the security model is the same.
The bottom line is that what you are trying to do requires elevation to "Run as Administrator", so no, you cannot do what you are trying to do with clients whose UAC is turned on.
http://msdn.microsoft.com/en-us/magazine/cc163973.aspx
http://msdn.microsoft.com/en-us/magazine/cc163973.aspx