manifest中的requestedExecutionLevel在Windows Server 2003上无法正常工作

时间:2014-01-31 12:06:24

标签: c# manifest windows-server-2003 uac

我在Windows Server 2003上运行C#应用程序时遇到问题。我的内部清单文件包含以下行

  <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>

它适用于Windows 7或8,当用户尝试运行没有管理员权限的应用程序时,会提示UAC。但是在Windows Server 2003上,用户可以在没有管理员权限的情况下启动它,并且不会提示UAC,因此应用程序无法正常工作。

1 个答案:

答案 0 :(得分:2)

UAC在Windows Server 2003中根本不存在,它仅在Windows Vista和Windows Server 2008中引入。

您的应用程序必须接受它可能在没有管理权限的情况下启动。因此,它必须对管理权限执行自己的检查,如果它发现它由管理员以外的其他人运行,它应该告诉用户然后退出。