self starting windows service
-
hi all, i had created a windows service and added a projectinstaller .then in the afterinstall event i am trying to start it using serviceController it installs succesfully but it is not started and i get the following exception :System.InvalidOperationException: Cannot start service Service1 on computer '.'. ---> System.ComponentModel.Win32Exception: The service cannot be started, either because it is disabled or because it has no enabled devices associated with it --- End of inner exception stack trace --- at System.ServiceProcess.ServiceController.Start(String[] args) at System.ServiceProcess.ServiceController.Start() at TestWindowsService.ProjectInstaller.serviceInstaller1_AfterUninstall(Object sender, InstallEventArgs e) and now if unsinstall it starts it seems afterinstall event is called in both after install and after uninstall.how can i make this service self starting i hadn't added any extra code(except in the afterinstallevent) in the windows service. ServiceController sc = new ServiceController("Service1"); sc.Start(); sc.Close(); i am using the windows service template. thanks in advance. Rakesh
-
hi all, i had created a windows service and added a projectinstaller .then in the afterinstall event i am trying to start it using serviceController it installs succesfully but it is not started and i get the following exception :System.InvalidOperationException: Cannot start service Service1 on computer '.'. ---> System.ComponentModel.Win32Exception: The service cannot be started, either because it is disabled or because it has no enabled devices associated with it --- End of inner exception stack trace --- at System.ServiceProcess.ServiceController.Start(String[] args) at System.ServiceProcess.ServiceController.Start() at TestWindowsService.ProjectInstaller.serviceInstaller1_AfterUninstall(Object sender, InstallEventArgs e) and now if unsinstall it starts it seems afterinstall event is called in both after install and after uninstall.how can i make this service self starting i hadn't added any extra code(except in the afterinstallevent) in the windows service. ServiceController sc = new ServiceController("Service1"); sc.Start(); sc.Close(); i am using the windows service template. thanks in advance. Rakesh
Have you checked whether the service starts up correctly when doing it manually via control panel?
-
Have you checked whether the service starts up correctly when doing it manually via control panel?
Hi robert, yes, i checked and it was starting perfectly.after being installed with installutil.any idea what is causing the problem.thanks in Advance. Rakesh