Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hai,

I created a application in .net using win-forms and C# now i want to convert in to a windows service . Any one have idea about this . This is not a console application.


Thanks in Advance
Posted
Comments
anvas kuttan 13-Sep-11 2:23am    
Actually i need to convert this exe to a service any idea pls
Tejas Vaishnav 13-Sep-11 5:00am    
PLease explain what work will perform by your exe...

Create a new project of type Windows Service and copy the existing code into it. You may also have to create an installer project for the service.
NOTE: You can't use any forms in a windows service.

Check out this cp article about services: Simple Windows Service Sample[^]
 
Share this answer
 
v2
Windows services have no UI, so you will have to take out everything that is user interface related.

This means you will have to re-architect your application and break it up into UI side and server side.

You will have to create a communication protocol for these two sides to talk through.

This is not a trivial undertaking.
 
Share this answer
 
Comments
anvas kuttan 13-Sep-11 2:22am    
hai,

Thank you for u reply actually i wont have any interface i created a project and create a EXE too now i want to convert this EXE to service
Its not sufficeint expalnation in your question you need to explain what your exe file work..

Hello friend if your exe file source will based on any UI (like textbox ect) control then it will be not possibel to convert that same code to windows service because windows service has no UI.

other wise if it is provide some kind of service like take data from database and perform some operation and make changes to database.. or on the dateand time base some work then your same code will converted in windwos service...
 
Share this answer
 
Well, you better make it service by default, as regular GUI makes no sense in case of a service and you need an other way of working in this case. Still, there are posibilities to "transform" regular application into a service. See:

https://www.youtube.com/watch?v=X6o1AvZ06zc[^]
https://technet.microsoft.com/en-us/library/cc990289.aspx[^]

But I have to emphasize, that shis is usable only if the application is able to run without direct user interaction.
 
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