Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to keep running C# application after windows log off

I wrote a C# application using RESTful web services. This application should interact periodically with our server application. I want this program to keep running in the background even if the user logs out of the computer. How can I do this in C#?

like image 399
Achchuthan Yogarajah Avatar asked Jan 03 '14 12:01

Achchuthan Yogarajah


1 Answers

If you don't want your application to stop when the user logs out, then the application can't be running in the user's session (really a WinStation). That implies your app needs to run in a different session. The sessions that don't logout are service sessions. Run Task Manager and add the Session ID column, and view all processes, and you'll see what I mean.

So your application needs to run as, or be launched by, a service.

like image 179
DougN Avatar answered Sep 26 '22 06:09

DougN