<分区>
我有一个 C# 应用程序,我正在尝试通过注册表编辑服务。我正在使用需要管理员权限才能运行我的应用程序的 list 文件。尽管如此,这段代码还是会抛出
System.UnauthorizedAccessException: Cannot write to the registry key.
RegistryKey key = Registry.LocalMachine.OpenSubKey ("SYSTEM\\CurrentControlSet\\services\\Tomcat7");
key.SetValue ("Start", 2, RegistryValueKind.DWord);
有人知道如何解决这个问题吗?