I have a winform application to read values from the registrykey..
so i know i have to run as administrator in order to do so.
I have two servers of win 2003. one is 32 bit and the other is 64 bit.
When i run this application on my 32 bit i have no problem and it reads the values from the registry..
but when i run the application from my 64 bit server it cannot read from the registry.
i get a
system.nullreferenceexception
as i cannot read the root of my reg key which returns null.
i have put a manifest file also but with that too its not working..
any help will be greatly appreciated... thanks..
here is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1">
<asmv1:assemblyIdentity version="1.0.0.31" name="FileShareMgmt.exe" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
<application />
<entryPoint>
<assemblyIdentity name="FileShareMgmt" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<commandLine file="FileShareMgmt.开发者_C百科exe" parameters="" />
</entryPoint>
<trustInfo>
<security>
<applicationRequestMinimum>
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
<defaultAssemblyRequest permissionSetReference="Custom" />
</applicationRequestMinimum>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->
</requestedPrivileges>
</security>
</trustInfo>
this is not the complete manifest as there are which i think wont be required to show here...
Have you verified that the key you're trying to read exists on the 64-bit system?
The path may be different for a 64-bit system: http://support.microsoft.com/kb/896459
If your registry key contains the text "WOW6432node", that's the 32-bit version. The 64-bit version will probably be the same except that part of the path won't be there.
This question may be related: Why is OpenSubKey() returning null on my Windows 7 64-bit system?
精彩评论