The worker processcalls OpenSubKey but returns null by accessing Remote Registry service.
- by Cary
My web server is deployed in IIS 6. The web server starts the Remote Registry service in the remote machine successfully by creating a process to run some remote operation commands.
This first line runs successfully. But the second line returns null.
#1 RegistryKey remoteRegKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, "139.24.185.27");
#2 RegistryKey targetKey = remoteRegKey.OpenSubKey(@"SOFTWARE\Wow6432Node\XXXX\XXXX\Config\Modality", true);
I tried to find the reason from MSDN. It tells only one case it would return null. The case is when the subkey does not exist.
If it has not enough permission, it will throw exception. But the subkey really exists. I change another machine to debug my code with Visual Studio 2008. It can run two lines successfully.
If it has enough permission, it should not only can open the LocalMachine, but also can open any of its subkeys.
I am quite confusing about this.