Set Registry value throws UnauthorizedAccessException

c#

Solution

This might help ,

Link to similar issue on stack overflow

looks like you are opening the key read only.

Problem

I have a C# application and I am trying to edit a service through the registry. I am using a manifest file that requires administrator privileges to run my application. Despite that, this code throws System.UnauthorizedAccessException: Cannot write to the registry key. ``` RegistryKey key = Registry.LocalMachine.OpenSubKey ("SYSTEM\\CurrentControlSet\\services\\Tomcat7"); key.SetValue ("Start", 2, RegistryValueKind.DWord); ``` Does anybody have any ideas for how to fix this?

Original source

Related problems