I have a shared class which calls the following registry key which is used by a Windows Service and also an ASP MVC3 website:
irsalKey = Registry.LocalMachine
.CreateSubKey("SOFTWARE")
.CreateSubKey("MyApp");
On my local (Win7 32bit) PC this works as expected.
On my test 2008 server, the Service read/writes the "Wow6432" node, but website does not? My guess is that the service is 32bit (uses 32 bit binaries) but the website is 64bit under IIS?
What can I do so that both read/write the same keys? It doesn't matter WHICH key this is, but it needs to be the same for both!
Thx
Googling pointed me to use the following:
RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)
It IS in MSDN, but the documentation wasn't too clear (to me anyway!) but this forces any RegistryKey to use it's 32bit version.