Hi,
I would like to write a little program which monitors a specified Service, and if it isn't running, starts it how is this possible please
Thanks
Hi,
I would like to write a little program which monitors a specified Service, and if it isn't running, starts it how is this possible please
Thanks
monitor
rvUser
Hi
If the person you are intending to give this to already has the .NET Framework installed and the only code you are using is that posted then you could just give them the executable file that resides in your project\bin directory. Alternatively, you can create a setup package by adding a Setup and Deployment project to your solution.
HTH
jomo
This is what I have now:
may be I should have a timer or something so that this gets checked all the time
instead of using the load event.
Thanks
private
void monitorForm_Load(object sender, EventArgs e){
ServiceController sc = new ServiceController("Lotus"); if ((sc.Status.Equals(ServiceControllerStatus.Stopped)) ||(sc.Status.Equals(
ServiceControllerStatus.StopPending))){
// Start the service if the current status is stopped. Console.WriteLine("Starting the Telnet service...");sc.Start();
}
// Refresh and display the current service status.sc.Refresh();
}
Dark Helmet
Hi
If you go to the computer management section of your computer and select the Services node you will see the name of the Lotus Domino Service. This is the name that you would use in place of "Messenger" when instantiating the ServiceController object.
HTH
JMMJ
Do I need to drag and drop a service controller from the toolBox
Thanks
Grigory_
Can I use the sample code you sent in .net 2.0
Thanks
spiritualfields
Hi, how about if i would like to monitor lotus service, I think it's service name is LotusDominoService.
Thanks
Deadman
Hi
I would imagine that a timer would be more than adequate for this, and the code would go into the Tick event of the timer.
N.S.
A D SRIKANTH
Thanks
Yusuke
Hi
You can use the ServiceController object to query the status of a service and start it if it is stopped. The following example checks the status of the Messenger service and if it is stopped will start it. This requires a reference be made to the System.ServiceProcess object:
Dim controller As New ServiceController("Messenger")'Determine the state of the "Messenger" service
Select Case controller.Status
Case ServiceControllerStatus.Stopped
'Start the service
controller.Start()
End Select
controller.Dispose()
HTH
Luca Bolognese
Hi
What operating system are you using If it is XP or Windows 2000 or later then you can right click on "My Computer" and from the context menu select "Management". You will then be presented with the MMC (Microsoft Management Console) window and on the left hand side will have a tree where you can access all the different management options such as the "Event Viewer" and "Device Manager". You should also see a node labelled "Services and Applications", within this node you will find an entry called "Services". Selecting this will then display a list of all services registered on your computer.
HTH
Sculli
How do I create a setup so that I can send something like .msi or .exe for the person to instal on his machine please
Jeff Wharton
Hi
Yes, you should be able to. The following link ServiceController Constructor is from MSDN2 and if you have a look at the ServiceController (string) overload entry you will see that the code is very similar to what I posted.
HTH
Santosh
Hi
No, all you need to do is add a reference to the System.ServiceProcess.dll and then use the code that I posted. To add a reference, right click on your project within the Solution Explorer and select Add Reference and then from the Add Reference Dialog scroll down to System.ServiceProcess.dll and press the Select button and then press the Ok button. You will then need to add the following Imports statement to the top of your code:
Imports System.ServiceProcess
My apologies as I had omitted that little fact in my earlier post.
HTH