简体   繁体   English

从ClickOnce应用程序访问Windows注册表失败

[英]Accessing Windows registry fails from ClickOnce application

here's another strange behaviour I'm currently facing. 这是我目前面临的另一个奇怪行为。 I have an application deployed on a network-drive with full-trust. 我将应用程序完全信任地部署在网络驱动器上。 This application checks for existing ODBC-Connections. 此应用程序检查现有的ODBC连接。

On my machine everything is fine and works as expected. 在我的机器上,一切正常,并且可以按预期工作。

On the machine of a colleague it is not working and states the message, that he isn't able to access the key. 在同事的机器上,它无法正常工作并显示消息,表明他无法访问密钥。 In "regedit" he is able to access and change it. 在“ regedit”中,他可以访问和更改它。 He's like me a local admin. 他就像我的本地管理员一样。

The Key the application is accessing is: 应用程序正在访问的密钥是:

var odbcKey = Registry.LocalMachine.CreateSubKey("SOFTWARE\\ODBC\\ODBC.INI");

Starting the same application with the *.exe everything is fine. 使用* .exe启动相同的应用程序,一切都很好。

Any ideas? 有任何想法吗?

You have to edit the permission of this registry key by going to the registry key then right click on it, then permissions .. then give the user permission to read from it. 您必须编辑该注册表项的权限,方法是转到注册表项,然后右键单击它,然后单击权限..,然后授予用户读取权限。 ( assuming u are using windows 7 ). (假设您使用的是Windows 7)。

I have faced the same problem, and it is fixed by giving the "write" permission for the correct user on this key, as you are trying to create a sub key in the registry which need permission. 我曾经遇到过同样的问题,并且通过在此注册表项上为正确的用户提供“写”权限来解决此问题,因为您正在尝试在注册表中创建需要权限的子项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM