本文介绍了我无法在"HKEY_LOCAL_MACHINE"中写入值;登记处的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想允许带有c#应用程序的远程桌面
我应该转到"HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Terminal Server"
并更改"fDenyTSConnections"值.
我写这段代码

Hi, I want to allow remote desktop with c# application
I should go to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server"
and change "fDenyTSConnections" value.
I write this code

RegistryKey Location = Registry.LocalMachine;


RegistryKey TerminalServer = Location.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Terminal Server",true);



但是我不能因为错误:不允许请求的注册表访问.

我想用C#



but i can''t because error : Requested registry access is not allowed.

I want do it with C#

推荐答案

app.manifest should be like this:

<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" 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">
   <assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
      <security>
         <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
            <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
         </requestedPrivileges>
      </security>
   </trustInfo>
</asmv1:assembly>


这篇关于我无法在"HKEY_LOCAL_MACHINE"中写入值;登记处的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 17:47