Viraj_Kanwade
asked on
ServiceController.Refresh(); problems with service and servicecontroller
I am using a service controller to start,stop and pause my service. now when i start my service(canpauseandcontinu e set to true) i check whether the service is pausable and according enable or disable my pause unpause button. but now the problem is after calling servicecontroller.start() the servicecontroller.status wont update. i tried using servicecontroller.refresh( ) but still the status wont refresh. but now the funnier part is when i debug, after calling refresh the status is updated. so i m pretty much confused.
also in my service i have set the canpauseandcontinue true, when i try to override the onPause() and onContinue method i get an error that cannot find a suitable onPause and onContinue methods.
also in my service i have set the canpauseandcontinue true, when i try to override the onPause() and onContinue method i get an error that cannot find a suitable onPause and onContinue methods.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Well, it's OnPause, with capital O. Every method in C# starts with a capital letter, it's not like Java
ASKER
public class ServiceTest : System.ServiceProcess.Serv
{
/// <summary>
/// Required designer variable.
--------------------------
static void Main()
{
System.ServiceProcess.Serv
// More than one user Service may run within the same process. To add
// another service to this process, change the following line to
// create a second service object. For example,
//
// ServicesToRun = new System.ServiceProcess.Serv
//
ServicesToRun = new System.ServiceProcess.Serv
System.ServiceProcess.Serv
}
--------------------------
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//
// ServiceTest
//
this.AutoLog = false;
this.CanPauseAndContinue = true;
this.ServiceName = "ServiceTest";
}
--------------------------
/// <summary>
/// Pause this service.
/// </summary>
protected override void onPause()
{
pause = true;
myLog.WriteEntry("Service Paused");
}
heres the error i get for using the override in above method
ERROR::::
'servicetest.ServiceTest.o