How to call Windows application using Windows serv

2019-07-22 12:19发布

问题:

I have created a Windows service with using that service. How will I call a Windows application?

回答1:

Windows services and Windows applications are completely different programs. Windows services are automatically started when the computer boots, have no user interface and have different security context than logged in user. You can't simply convert a Windows application to a Windows service (and expect it to run smoothly). If you want your program to always run (24/7) with no user interface then you can look into Windows services.

More on Windows services: "Windows Service vs Windows Application - Best Practice" and "Windows Service Applications".



回答2:

You have to pick a Windows service from the project type in Visual Studio. If you meant how can you host an application as a Windows service, the only way to do this is to create a new project of type Windows Service and use the Process class.

You can then create an install class and then use installutil or alternatively, use sc from the command line to install it.



回答3:

Hey, you can easily run ANY application as Windows service with this utility - Application As Service by Eltima