我的VB.NET Windows服务无法启动UAC启动

问题描述:

大家好,



我是VS.NET新手(但是VB6老手)。我正在编写一个包含GUI和后台Windows服务的VB.NET(2010)应用程序。我的服务是在所有典型的操作方法文章之后创建的。



我的Windows服务使用installutil和VS命令提示符安装得很好,但我无法获得在不关闭UAC的情况下实际启动的服务。如果UAC保持打开,我会得到可怕的错误740:请求的操作需要提升。



HUH ???



此服务作为LocalSystem安装,是任何系统上的绝对最高权限访问,甚至高于Admin。为什么地球需要进一步升高?即使编辑清单/配置升高也不会使这个错误消失,这使得这一切对我来说都显得非常破碎。



线索:同样,服务点火了如果UAC被禁用,则不需要这样做。



我已阅读Windows服务操作方法文章,并尽我所能跟踪它们,他们都没有提到过这个问题。我显然不能强迫我的用户关闭UAC,所以必须有一些我忽略的东西。



真的很想帮忙这个,感谢任何人可以协助!



清单看起来像这样



Hi Everyone,

I am new to VS.NET (but VB6 veteran). I'm writing a VB.NET (2010) app that has both a GUI and a background Windows Service. My service was created following all the typical "how-to" articles.

My Windows Service installs just fine using installutil and VS command prompt, but I can't get the service to actually start without turning UAC off. If UAC is left on, I get the dreaded "Error 740: The requested operation requires elevation".

HUH???

This service installs as LocalSystem, the absolute highest privileged access on any system, even higher than Admin. Why on earth would further elevation be required? Even editing manifest/config for elevation doesn't make this error go away, which makes this all seem very broken to me.

Clue: Again, the service fires right up if UAC is disabled, which should NOT have to be required.

I have read Windows Service "how-to" articles and followed them to the best of my ability, and none of them ever mention this issue. I obviously cannot force my users to turn UAC off, so there must be something I'm overlooking.

Really desperate for help on this one, my thanks to anyone who can assist!

The manifest looks like this

<security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!-- UAC Manifest Options
            If you want to change the Windows User Account Control level replace the
            requestedExecutionLevel node with one of the following.

        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

            Specifying requestedExecutionLevel node will disable file and registry virtualization.
            If you want to utilize File and Registry Virtualization for backward
            compatibility then delete the requestedExecutionLevel node.
        -->
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>

<security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!-- UAC Manifest Options
            If you want to change the Windows User Account Control level replace the
            requestedExecutionLevel node with one of the following.

        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

            Specifying requestedExecutionLevel node will disable file and registry virtualization.
            If you want to utilize File and Registry Virtualization for backward
            compatibility then delete the requestedExecutionLevel node.
        -->
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>