简体   繁体   中英

Can a windows service start an application without being logged in?

My question is one more of possibility then a how to. I currently have two custom windows services, one sends files from the client to the host over a network using TCP, the other receives those files and once the transfer is complete launches a C# application that begins to upload those files to the database (Both servies do more but that is the basic idea on what they do). My question is, is it possible to have the service running on the host(server) launch the C# application to upload without a user being logged in? Or am I going to have to turn that application into a service as well?

is it possible to have the service running on the host(server) launch the C# application to upload without a user being logged in?

That's the whole point of windows services - they run without anyone being logged in.

And yes, they can launch other processes - this is usually done via the Process class.

Process.Start("path to application", "command line arguments");

You can use the returned Process reference and terminate it later on (if it is not self terminating) to ensure your server doesn't execute multiple copies of it and runs out of memory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM