Hi,
How can i call custom method on a windows service:
public class TestService:ServiceBase
{
public TestService()
{
// constructor
}
protected override void OnStart(string[] args)
{
// do some work here
}
protected override void OnStop()
{
// do some work here
}
public void TestMethod(int arg)
{
// do some work here
}
}
I know that name of the service is "TestService", so i can do the following:
ServiceController sc = new ServiceController("TestService");
But if I do the following, it doesn't work
sc.TestMethod(5); // cannot do this
How can i access a method on the service? I am using c#
Thanks.