Click here to Skip to main content
15,913,773 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 :
VB
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
Posted
Updated 12-Dec-11 0:34am
v2
Comments
Amir Mahfoozi 12-Dec-11 6:37am    
May be this is something related to your service not this code.

1 solution

Check if the service can pause and continue with myMNCPServiceControler.CanPauseAndContinue. More info:
http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicecontroller.canpauseandcontinue.aspx[^]

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900