vs2012创建Windows服务

一、创建一个Windows Service

1、创建Windows Service项目

创建好了如下图,

 

二、创建服务安装程序

打开Service1.cs

右键,点击安装程序

选定“serviceProcessInstaller1”,设置Account属性值为“LocalSystem”,LocalSystem是服务中的最高权限,其它权限相对低一些,相关内容可以查询资料;

右键serviceInsraller1,选择属性,修改服务名和说明

三、安装

生成后,打开

输入InstallUtil.exe C:\Users\xxxxx\Desktop\WindowsService1\WindowsService1\bin\Debug\WindowsService1.exe

 

卸载installutil /u C:\Users\xxxxx\Desktop\WindowsService1\WindowsService1\bin\Debug\WindowsService1.exe

 

posted @ 2015-03-11 11:42  微笑的飞鸟  阅读(833)  评论(0编辑  收藏  举报