How do I change settings of Windows Service while it’s running?
Let’s say I process files from one directory to another. I’d like to be able to declare the output and operations for next files (while the service is running). Would be perfect if I could edit it remotely via website (SQL tables or maybe XML/TXT files).
Is it at all possible without restarting service? Could I simply write inside service “for every file read operations and output from settings file“?
I’d rather avoid for now Windows Communication Foundation.
Assuming you also wrote the Windows Service, you could send a custom command to the service. From the controller side, you use
ServiceController.ExecuteCommand()to send the command. On the service class, you overrideServiceBase.OnCustomCommand()to process the commands.This will only help you trigger an action, however. You will still have to use an external method (e.g. shared configuration file) to convey the details of the action.