I have an exe app that I run on IIS (from C:\inetpub\wwwwroot
in DefaultAppPool
) and needs to access the registry, but it doesn't work, it seems like it doesn't have permission. What's weird is I ran it on Windows 8 and it works fine, but on Windows 7 and Server 2012 hosts it doesn't run. I know registry keys have permissions and I've even tried to set Everyone
to full control, but it still fails. I also tried both HKEY_CURRENT_USER
and HKEY_LOCAL_MACHINE
, no luck.
I did read about trust levels but I'm unsure what those are, the only references I could find related to ASP apps. Is there something I need to add to web.config or to IIS management console to allow my CGI app to access the Registry, ideally under HKCU?
Edit: Tried to see what went on with Process Monitor but I can't see any line about it. I did however write this quick Perl script to replicate this:
use strict;
use Win32API::Registry qw (:ALL);
print "Content-type: text/plain\n\n";
RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\TestingRegistryAccess", 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, [], my $rh, []) or print regLastError();
if(defined($rh)) { RegCloseKey($rh); }
And the output is:
Access is denied.
So there has to be some way to allow a CGI script to access this, it works on my Win8 desktop.