创建window service --菜鸟篇
2009-03-27 15:50
134 查看
1.打开vs---->新建windows服务
2.设置属性
CanPauseAndContinue:是否可以暂停与继续
CanStop ;是否可以停止
3.在工具栏里拖timer空间到设计器(注:system.timers.timer ,如果没有点击“选择项”添加)
4.设置timer 属性
Enabled:启用定时
Interval:运行间隔(毫秒)
5.添加代码
onStart():这里是服务启动时运行的代码
onStop():这里是服务停止时运行的代码
timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)在这里添加要定时运行的代码
6.添加安装程序
右键点击设计器--->添加安装程序
account:localSystem
startType:auotmatic
7.注册服务
installutil.exe 你的服务所在目录
2.设置属性
CanPauseAndContinue:是否可以暂停与继续
CanStop ;是否可以停止
3.在工具栏里拖timer空间到设计器(注:system.timers.timer ,如果没有点击“选择项”添加)
4.设置timer 属性
Enabled:启用定时
Interval:运行间隔(毫秒)
5.添加代码
onStart():这里是服务启动时运行的代码
onStop():这里是服务停止时运行的代码
timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)在这里添加要定时运行的代码
6.添加安装程序
右键点击设计器--->添加安装程序
account:localSystem
startType:auotmatic
7.注册服务
installutil.exe 你的服务所在目录
相关文章推荐
- C#创建Window Service
- vs创建window service以及删除服务的方法
- 创建 window service 定时任务
- 创建简单的Window Service 实例
- 创建 window service 定时任务
- 创建简单的Window Service 实例
- C# window service的创建
- Window Service 创建:在后台执行一个服务,可定时做一些操作,如轮询数据库,定时发邮件
- c#创建window service
- Service学习——第一篇(创建简单的Service)
- Java程序员从笨鸟到菜鸟之(二十九)javascript对象的创建和继承实现
- 创建自定义自启动LINUX服务service
- WebGL中使用window.requestAnimationFrame创建主循环
- SSH项目中创建action、service和serviceImpl步骤
- 解决方法:创建Andriod Virtual Devices 时,点击start后, 没有出现Launch Options window
- window service程序中的word automation问题??
- Binder service入门–创建native binder service
- ServiceLoader使用和创建组件的内容区分开来
- 在 UWP 应用中创建、使用、调试 App Service (应用服务)
- C# 创建window服务