orenisraeli2000
asked on
How to install a windows service and make hime run without reboot.
Hello,
I have a .Net App and a .Net windows service.
I'm using a Project Installer to install them on clients computer. How do I make the installed service to start running immediately without reboot. I don't want to do it manually using "My Compurt->Manage-> ...." I'm looking for a script or something.
Please give full solution. I'm using .Net 2
I have a .Net App and a .Net windows service.
I'm using a Project Installer to install them on clients computer. How do I make the installed service to start running immediately without reboot. I don't want to do it manually using "My Compurt->Manage-> ...." I'm looking for a script or something.
Please give full solution. I'm using .Net 2
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you can create a bat file to start the service or stop the service using the net start and net stop commands
stopping the service
net stop "Service Name"
starting the service
net start "Service Name"
stopping the service
net stop "Service Name"
starting the service
net start "Service Name"
ASKER
talker2004: I dont understand where to put your code and how to invoke it.
tgerbert : Nice solution but Where to put the code?? I've put the code in the ProjectInstaller.cs file and nothing new happed.
tgerbert : Nice solution but Where to put the code?? I've put the code in the ProjectInstaller.cs file and nothing new happed.
ASKER
Correction, all is good.
I loved this fancy pants solution.
nice1
I loved this fancy pants solution.
nice1
when I seen tgerbert solution I knew his was going to beat mine out. Overriding the commit method was pretty slick to get it done during the install.
// you will need to make reference to system.serviceprocess
System.ServiceProcess.Serv
public void StartController()
{
try {
this.ServiceController.Ref
if (this.ServiceController.St
ServiceController.Start();
}
}
catch (Exception ex) {
}
}