i want to turn windows service on when it is off. is it possible to make via code from web application with c#? i am using asp.net mvc and c#.
A Windows Service may launch a UI application but this application will never be displayed on the currently logged-in user's desktop. This tip shows how to launch a UI application from a Windows Service by using the Windows API.
Microsoft Windows services, formerly known as NT services, enable you to create long-running executable applications that run in their own Windows sessions. These services can be automatically started when the computer boots, can be paused and restarted, and do not show any user interface.
You're looking for the ServiceController
class.
Its possible to do it but its unlikely that you want to run your website under an account which has enough rights to be able to Start/Stop services. You can use the ServiceController class to start a service see here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With