Click here to Skip to main content
15,903,724 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
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

XML
<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>
Posted
Updated 25-Aug-15 12:25pm
v2
Comments
Wendelius 25-Aug-15 14:02pm    
What does your manifest look like?
Member 8474866 25-Aug-15 17:48pm    
Manifest code not showing up right as a comment...
Member 8474866 25-Aug-15 17:50pm    
Darn it - it's not posting my code properly. Posting in solution section instead...

1 solution

XML
<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>
 
Share this answer
 
Comments
Patrice T 25-Aug-15 18:26pm    
Posting this as a solution is the wrong move.
you should have used Improve question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900