Hi Arturo,
Thanks for your feedback.
Oh, this sounds an unusual situation to me. Does the Registry.GetValue
only returns a null reference? Is there any exception throw in your COM+
application? If this is a permission issue, Registry.GetValue() should
throw SecurityException as documented in MSDN.
Also, does this problem happen to all registry keys under HKLM or several
specific keys? I have created a sample ServicedComponent followed the steps
in the article below(running under the interactive user account):
http://www.15seconds.com/issue/030501.htm My code looks like this:
'''Server
<Assembly: ApplicationName("MyRegService")>
<Assembly: AssemblyKeyFile("..\..\bin\key.snk")>
<Assembly: ApplicationActivation(ActivationOption.Server)>
Public Class MyRegService
Inherits ServicedComponent
Public Function GetRegValue(ByVal keyName As String, ByVal valueName As
String) As String
Return Registry.GetValue(keyName, valueName, Nothing)
End Function
End Class
'''Client
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim obj As RegistryComponent.MyRegService = New
RegistryComponent.MyRegService()
MsgBox(obj.GetRegValue("HKEY_LOCAL_MACHINE\SYSTEM\Setup",
"SystemPartition"))
End Sub
End Class
I am reading SystemPartition value under HKLM\SYSTEM\Setup key. It works
without any problem. So it seems that I can not reproduce your problem
locally.
To troubleshoot this issue, I would recommend you to use Process Monitor to
monitor the registry activities of your COM+ process. In dcomcnfg.exe, if
your COM+ starts, your application will be listed under the "Running
Processes" node. In it, you will find the your running COM+ process id.
Then, in the ProcMon, you may filter by the process id so that you only
monitor your COM+ application registry activity.(remember to dismiss the
file system button so that ProcMon will not show the file system activity).
Also, you may input add another filter "Path" "Contains"
"HKLM\SYSTEM\Setup" to eliminate the unnecessary output. You may download
ProcMon from the link below:
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx I think the ProcMon records may reveal why the registry access fails. You
may paste it here for analysis.
Finally, it would be more efficient if you could provide a sample project
with detailed reproduce steps. Before doing this, you might want to check
if this problem can be reproduced on other machines.
Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
=========================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
This posting is provided "AS IS" with no warranties, and confers no rights.