Make a C # window application as a window service

I have a desktop application in C # and I want to do this window service. Is it possible to make this application a Windows service? Basically, I want the application to show gui when it was needed, and upone to minimize it, and it should also appear in services ... For the application, just take the example that my application has a timer and a multi-line text box, and also interacts the database is with it and its display of the timely status from the database, so when I need to see it, I can start the graphical interface from the system, try it?

Any help would be greatly appreciated. Thanks!

+4
source share
2 answers

You will need to separate your applications. Windows Service and desktop. You will need to create API hooks in your Windows service in order to communicate with your desktop application and service. I would recommend WCF for this.

In short, the Windows service should not interact with the desktop. It will be launched in a separate session than the session you are logged into, even if you are logged in as the same account in which the service is running.

+3
source

Unable to display GUI in Windows service. What you can do is:

a. Separate client logic from server logic, the Windows service will perform operations on the server side and will expose the WCF API to the client, which will handle GUI-related problems.

b. Use an external tool such as Service-O-Matic to manage your winforms application as if it were a Windows service. cm.:

http://www.kwakkelflap.com/service.html

+1
source

All Articles