简体   繁体   中英

Registry System.UnauthorizedAccessException

when I'm trying to create a subkey in Registry.ClassesRoot I get an System.UnauthorizedAccessException! I'm using win7. Does anyone know why?

Because only people in the Administrator group can create keys under HKEY_CLASSES_ROOT .

In general, you shouldn't need to be creating keys under there (if it's part of an install process, then you should probably be using a proper installer with transaction and rollback support - such as Windows Installer - not rolling your own).

But to solve your specific problem, then you need to run your application as Administrator.

Check that your program run as administrator. By default win7 does not run programs with admin permissions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM