Hello everybody,
I have created a sample windows service in C# in 2.0 framework.when I am running the service from the command prompt I am not able to see the service in the services list ,what may be the reason do i need to write any installer class .please help me.
Thanks,
Ranjith
Loading
AlanPosted Nov 18, 2007, 5:56 AM
That code looks OK to me.
The most likely reason why it's not starting automatically is because you're attempting to use or do something which isn't available to the system at bootup time such as calling another service which hasn't yet started.
I'd have a look at the event log to see whether there are any clues there.
ranjith nPosted Nov 17, 2007, 5:19 AM
Thank you very much for answering my question patiently,I have cleared all my problems and developed the service,and I am able to run the application,it is working evrything is fine.But now I face a different problem.
I have developed my service as automatic startup mode.i.e when the system reboots it should start automatically.But when I restart the system,I can only see the service there in the list,but it is not starting automatically,again I am starting that manually.....what may be the reason.please tell me.
Here I am sending the code for my installer class.
private void InitializeComponent()
{
this.WinMQSOAPPollservice_Installer = new System.ServiceProcess.ServiceProcessInstaller();
this.WinMQSOAPPollInstaller = new System.ServiceProcess.ServiceInstaller();
//
// WinMQSOAPPollservice_Installer
//
this.WinMQSOAPPollservice_Installer.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
this.WinMQSOAPPollservice_Installer.Password = null;
this.WinMQSOAPPollservice_Installer.Username = null;
//
// WinMQSOAPPollInstaller
//
this.WinMQSOAPPollInstaller.ServiceName = "WinMQSOAPPollService";
this.WinMQSOAPPollInstaller.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// ProjectInstaller
//
this.Installers.AddRange(new System.Configuration.Install.Installer[] {
this.WinMQSOAPPollservice_Installer,
this.WinMQSOAPPollInstaller});
}
AlanPosted Nov 14, 2007, 9:53 AM
I think we'll need to see some code, Ranjith, to answer that one.
I take it you've got some code in the OnStart() method?
I'd also double-check your Main() method to ensure you've covered all the steps in Mahesh's article.
ranjith nPosted Nov 14, 2007, 4:09 AM
Now I moved further but struck up again..I am able to see the service but when I start the service it is closing immediately saying that service has nothing to perform .what is the reason?
Mahesh ChandPosted Nov 13, 2007, 8:13 AM
Here are step by step instructions:
http://www.c-sharpcorner.com/UploadFile/mahesh/window_service11262005045007AM/window_service.aspx
AlanPosted Nov 13, 2007, 6:06 AM
Yes, you do need to install a Windows service for it to show up in the 'services' list.
There's a command line utility called InstallUtil.exe which can be used for this purpose.
So go to the VS or .NET SDK command prompt, navigate to the folder where the service resides, and type:
installutil myservicename.exe
to install and, if you should ever need to uninstall, type:
installutil /u myservicename.exe