The worker processcalls OpenSubKey but returns null by accessing Remote Registry service.

Posted by Cary on Stack Overflow See other posts from Stack Overflow or by Cary
Published on 2010-04-01T11:24:48Z Indexed on 2010/05/25 7:21 UTC
Read the original article Hit count: 306

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about iis6

Related posts about remote-registry