暂停自定义服务 [英] Pause Custom service
本文介绍了暂停自定义服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在项目中创建Windows自定义服务.
每当我通过编码开始或停止时,我都会控制此服务.
但是无法暂停,但显示错误(即:无法暂停计算机''.''上的MNCPService服务)
我的代码如下:
I create windows custom service in my project.
I control this service whenever I start or stop through coding.
But not working in pause, error shown(i.e.: Cannot pause MNCPService service on computer ''.'')
My code is below :
Dim myMNCPServiceControler As ServiceController
myMNCPServiceControler = New ServiceController(mncpServiceManager)
If MNCPServiceManagerStatus = ServiceControllerStatus.Stopped.ToString() Or MNCPServiceManagerStatus = ServiceControllerStatus.Running.ToString() Then
myMNCPServiceControler.Pause()
myMNCPServiceControler.Refresh()
End If
请帮助我
Please help me
推荐答案
检查服务是否可以暂停并继续使用myMNCPServiceControler.CanPauseAndContinue
.更多信息:
http://msdn.microsoft.com/en-us/library/system. serviceprocess.servicecontroller.canpauseandcontinue.aspx [ ^ ]
祝你好运!
Check if the service can pause and continue withmyMNCPServiceControler.CanPauseAndContinue
. More info:
http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicecontroller.canpauseandcontinue.aspx[^]
Good luck!
这篇关于暂停自定义服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文