[英]GAC assembly reading registry - c#
I have an assembly that installed in the GAC. 我有一个安装在GAC中的组件。 Can this assembly access registry values in HKEY_LOCAL_MACHINE\\SOFTWARE\\COMPANYNAME
该程序集能否访问HKEY_LOCAL_MACHINE\\SOFTWARE\\COMPANYNAME
注册表值
I do not get any error but am not able to read subkey from above path. 我没有收到任何错误,但无法从上述路径读取子项。 My assembly is strongly signed. 我的程序集已签名。
Reason I am using registry is because use of config file is not permitted. 我使用注册表的原因是因为不允许使用配置文件。
Sample code 样例代码
string regKey = "HKEY_LOCAL_MACHINE\SOFTWARE\COMPANYNAME";
string userGUID = (string)Registry.GetValue(regKey, "userGUID", "-1");
If you are running 64-bit OS and your assembly is x86, or called by a x86 process, then your registry call is redirected to HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\COMPANYNAME
node. 如果您运行的是64位OS,并且程序集是x86或由x86进程调用,则您的注册表调用将重定向到HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\COMPANYNAME
节点。 This can be the source of your problem. 这可能是问题的根源。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.