I have a WPF application and I want to have it run as a service how do i do it in C#?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
EDIT (Based on comment)
If you want to make the program run at startup the easiest would be to change the setup to create a shortcut of the application output (exe) in the below directories:
WIN 7: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
XP: C:\Documents and Settings\All Users\Start Menu\Programs\Startup
Original explanation
Well given that a WPF application is a UI based application and a windows service is not, you would have to take out all of the interaction with the user from the application and then basically recreate it as a service.
There is no easy 1 step process to do this given that they are made to do 2 completely different things.
A service sits in the background and performs tasks that do not recuire user intput, and in most cases does not interact with the user except for a config file; Even though you can run the service to interact with the desktop but that works completely different from a normal wpf program.
A Wpf program on the under hand (as the presentation part of the name suggests) is made to interact with the user.
Why would you want to run it as a service? The whole point of a service is to run in the background with minimum user interaction.