G
Guest
I have wrote a Windows Service using C# classes, which contains only one service
I have installed multiple instance of this service
e.g. First service name is "MyService1" and second service name is "MyService2"
They both run same executable, but with different parameter. And I am storing that parameter unde
"..\CurrentControlSet\Services\MyService1\Parameters" and "..\CurrentControlSet\Services\MyService2\Parameters
respectively during installation in registry
I want to receive ServiceName as argument When user Start service with "Service Control Manager"
In my C++ version of the Service, I was using following cod
SERVICE_TABLE_ENTRY st[]
{ L"", ServiceMain }
{ NULL, NULL
}
StartServiceCtrlDispatcher( st )
Which was passing ServiceName in ServiceMain() argument list upon the Start of the Service through "Service Control Manager"
I am looking for similar mechanism in C# code, which I am unable to find
I have tried to call System.ServiceProcess.ServiceBase.Run( new MyServiceBase() ) with blank ServiceName in MyServiceBase class, which does not work
I wrote separate executable to help me start and stop service, where I am passing ServiceName as argument while calling ServiceController.Start()
It works fine, but we don't want to use this executable in our production environment, instead we want to use "Service Control Manager"
I am running out of idea, so any suggestion will help me.
I have installed multiple instance of this service
e.g. First service name is "MyService1" and second service name is "MyService2"
They both run same executable, but with different parameter. And I am storing that parameter unde
"..\CurrentControlSet\Services\MyService1\Parameters" and "..\CurrentControlSet\Services\MyService2\Parameters
respectively during installation in registry
I want to receive ServiceName as argument When user Start service with "Service Control Manager"
In my C++ version of the Service, I was using following cod
SERVICE_TABLE_ENTRY st[]
{ L"", ServiceMain }
{ NULL, NULL
}
StartServiceCtrlDispatcher( st )
Which was passing ServiceName in ServiceMain() argument list upon the Start of the Service through "Service Control Manager"
I am looking for similar mechanism in C# code, which I am unable to find
I have tried to call System.ServiceProcess.ServiceBase.Run( new MyServiceBase() ) with blank ServiceName in MyServiceBase class, which does not work
I wrote separate executable to help me start and stop service, where I am passing ServiceName as argument while calling ServiceController.Start()
It works fine, but we don't want to use this executable in our production environment, instead we want to use "Service Control Manager"
I am running out of idea, so any suggestion will help me.