通过cmd命令安装、调试 卸载、启动和停止Windows Service(InstallUtil.exe)
来源:互联网 发布:java常见面试题集合 编辑:程序博客网 时间:2024/05/17 02:09
自己写的服务是什么版本的对应找到版本下面的InstallUtil.exe所在的位置一般安装在
C:\Windows\Microsoft.NET\Framework\版本
1。运行--〉cmd:打开cmd命令框
2。在命令行里定位到InstallUtil.exe所在的位置
cd C:\Windows\Microsoft.NET\Framework\版本 回车
3。操作命令:
1). 安装服务命令:在命令行里输入下面的命令:
InstallUtil.exe Path/WinServiceName.exe
其中Path表示ServiceName.exe所在的位置,回车即可
比如 InstallUtil.exe F:\PL\VS2010\WeatherWarnInfoService\WeatherWarnInfoService\WeatherWarnInfoService\bin\Debug WeatherWarnInfoService.exe
或者 InstallUtil.exe 直接拖过来你服务下面的exe
安装:直接找到对应的 installutil.exe,拖cmd中,再拖你服务的位置路径下的服务名称.exe
2). 启动服务命令
net start ServiceName
ServiceName是真正的Service的名称(ServiceBase.ServiceName),跟.exe的名称可能一样,也可能不一样。如果不清楚,就到已安装的服务里面找到你的服务,右键属性里面看服务名称
3). 停止服务命令
net stop ServiceName
4). 卸载服务命令:在命令行里输入下面的命令:
InstallUtil.exe /u Path/WinServiceName.exe
其中Path表示ServiceName.exe所在的位置,回车即可
调试:
卸载:直接找到对应的 installutil.exe,拖cmd中,/u 再拖你服务的位置路径下的服务名称.exe
个人觉得这种方式也还用得下去,即调试起来感觉还不错的 !
1. 首先在你的服务源代码中添加一个定时器,定时器的示例代码如上所示。
2. 在服务的 Start 事件中启动定时器,并且将定时器设置为可用状态。
3. 在服务中添加如下代码:(我的定时器为 3 秒钟)
protected override void OnStart(string[] args)
{
System.Timers.Timer ti = new System.Timers.Timer(3000);//
ti.Elapsed += new System.Timers.ElapsedEventHandler(theout);//到达的时候执行的事件
ti.AutoReset = true; //设置是执行一次(false)还是一直执行(true);
ti.Enabled = true;
Log.LogMsg("start");
}
设置断点
启动服务
调试附件到进程,
就可以调试了
C:\Windows\Microsoft.NET\Framework\v2.0.50727
cd C:\Windows\Microsoft.NET\Framework\v2.0.50727
F:\P\VS2010\WeatherWarnInfoService\WeatherWarnInfoService
\WeatherWarnInfoService\bin\Debug
用什么版本写的服务,找到对应版本c盘下的文C:\Windows\Microsoft.NET\Frameworkv4.0.30319 回车
installutil.exe 自己写服务名称.exe所在目录复制 回车
C:\Windows\Microsoft.NET\Framework\v4.0.30319
- 通过cmd命令安装、调试 卸载、启动和停止Windows Service(InstallUtil.exe)
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- 通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- 通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- 通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- 通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- 通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- 用vs命令提示符来使用 Installutil.exe来安装和卸载Windows服务
- 无法从命令行或调试器启动服务,必须首先安装Windows服务(使用installutil.exe),然后用ServerExplorer、Windows服务器管理工具或NET START命令启动它,
- 无法从命令行或调试器启动服务,必须首先安装Windows服务(使用installutil.exe),然后用ServerExplorer、Windows服务器管理工具或NET START命令启动它
- 无法从命令行或调试器启动服务。必须首先安装Windows服务(使用installutil.exe),然后用ServerExplorer、Windows服务器管理工具或NET START命令启动它。
- 服务(安装 卸载 启动 停止)命令
- Java通过CMD命令启动和停止外部应用程序
- 无法从命令行或调试器启动服务,必须首先安装Windows服务(使用installutil.exe),然后用ServerExplorer、Windows服务器管理工具或NET START命令启动它的解决
- ios实现toast
- hadoop学习
- matlab filter与filtfilt函数实现,C语言实现
- LeetCode 137. Single Number II (位运算)
- 实训所用Python
- 通过cmd命令安装、调试 卸载、启动和停止Windows Service(InstallUtil.exe)
- Shader入门——我的第一篇shader
- 第四周【项目1-星号拼字母】
- android上jni跑图像分类程序崩溃了,报错libc : Fatal signal 11 ... gif图像通道数是1啊
- 第4周项目2建设“单链表”算法库 .
- css3之几种盒模型
- AlertDialog.Builder setPositiveButton 点击时不关闭dialog
- 启动Eclipse,Maven插件提示如下错误
- Java NIO原理 图文分析及代码实现