1. Execute Permissions
For generic service items, you need to open visual Studio with administrator privileges. Right-click items, Properties---security such as:
Shanghong in the box section, the project will add files app.mainfest such as:
The contents of the file:
<?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"> <!--UAC manifest option if you want to change the Windows user Account Control level, replace the requestedExecutionLevel node with one of the following nodes. <requestedexecutionlevel level="AsInvoker"uiaccess="false"/> <requestedexecutionlevel level="requireadministrator"uiaccess="false"/> <requestedexecutionlevel level="highestavailable"uiaccess="false"/>specifying the requestedExecutionLevel node disables file and registry virtualization. If you are using file and registry virtualization for backward compatibility, remove the requestedExecutionLevel node. -<requestedexecutionlevel level="requireadministrator"uiaccess="false"/> </requestedPrivileges> <applicationRequestMinimum> <defaultassemblyrequest Permissio Nsetreference="Custom"/> <permissionsetclass="System.Security.PermissionSet"version="1"Unrestricted="true"Id="Custom"Samesite="site"/> </applicationRequestMinimum> </security> </trustInfo> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <application> <!--This application is designed to use a list of all versions of Windows. Windows will automatically select the most compatible environment. -<!--If the application is designed to use Windows Vista, uncomment the following Supportedos node-<!--<supportedos id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>--> <!--If the application design uses Windows7, please uncomment the following Supportedos node-<!--<supportedos id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>--> <!--If the application is designed to use Windows8, please uncomment the following Supportedos node-<!--<supportedos id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>--> <!--If your application is designed to use Windows8.1, uncomment the following Supportedos nodes-<!--<supportedos id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>--> </application> </compatibility> <!--themes for Windows Common Controls and dialog boxes (Windows XP and later)--< !--<dependency> <dependentAssembly> <assemblyidentity Type="Win32"name="Microsoft.windows.common-controls"version="6.0.0.0"processorarchitecture="*"PublicKeyToken="6595B64144CCF1DF"language="*"/> </dependentAssembly> </dependency>--></asmv1:assembly>
When you compile or start a project, if you have insufficient permissions, you are prompted to run Visual Studio as an administrator, and then select Yes to automatically rerun Visual Studio as an administrator.
2.
C # Service Development