install windows service in windows 7 [closed]
i use the code for install Service in XP:
@"%windir%\Microsoft.NET\Framework\v2.0.50727\Path +@"\service.exe
But in Windows 7 this code is problem
In Windows 7 you have to run the command line as admin for this to work.
To do that, click the Start "orb", type "cmd" as usual but instead of pressing Enter, hold CTRL
+SHIFT
together then press Enter. Dialog will appear, confirm it and you'll get administrative access and the installation should work as expected.
Normally, I use "installutil.exe -i myAppExe" command for installing. Cant you use this command?
Only an elevated process (it is not enough to be logged into the machine as a member of the Administrators group) can install a service. If you're doing it from the command prompt, make it an elevated one (right clicking the shortcut and choosing Run As Administrator works, as well as @Shadow Wizard's instructions.) If you're doing it in code, the app will need to be elevated.
精彩评论