Click here to Skip to main content
15,916,030 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm having windows Service exe which one is done by Delphilite.
now i want to add that exe in my windows services so i wite the bellow codings

C#
System.Diagnostics.Process process = new System.Diagnostics.Process();
               System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
               startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
               startInfo.FileName = "cmd.exe";
               startInfo.Arguments = "C:\\Test\\Winservice1.exe /install /silent";
               process.StartInfo = startInfo;
               process.Start();


but it is not working

then how to install my service using c#

Please help me...!
Thanks in advance.....!
Posted
Comments
CHill60 23-Jan-14 7:40am    
"but it is not working" ... in what way does it not work? Post details of how it is different to what you expected or any errors that are thrown.
Does the account that you are running this under have the necessary permissions to install a service?

1 solution

there are many good examples
1- http://msdn.microsoft.com/en-us/library/ms733069%28v=vs.110%29.aspx[^]
2- http://dotnetmentors.com/example-for-hosting-wcf-service-in-windows-service.aspx[^]
3- http://wcftutorial.net/wcf-windows-service-hosting.aspx[^]

when you succeed to compile your service (including service installer class), you use 'installutil' .net utility to register your exe as a windows-hosted service.

actually you have several options how to host your service. see http://msdn.microsoft.com/en-us/library/ms731758%28v=vs.110%29.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900