0
kicks
Yet Another Service Wrapper - The Ultimate Service
I recently had a requirement to wrap executables and libraries so they would run as a service. My specific requirements were the following, in this context a task is defined as any method set to run within the service.
Allows for impersonation so each code set can run under a different user account.
Has the ability to run multiple separate tasks under a single instance of the service. Each task must run under a separate thread to allow multiple threads of the same task to be running concurrently.
Supports two types of tasks, polling (fired after a short interval) and scheduled (fired once per day at a fixed time).
Tasks are specified in a configuration file.
Must support class creation and method parameters. This includes support for arrays as parameters.
Must support static and instance methods.
Must support executing methods in executables as well as libraries with minimal to no change to existing code.
Each task must be able to use its own configuration file.
Changes to a task's files will cause the task to reload.
After searching the web for such a wrapper I could not find one that would satisfy all of these requirements. I did find many examples of service wrappers but while each had various pieces of the functionality I needed none had all the requirements. The biggest drawback I found in previous design was forcing the user to use an interface. Unfortunately I could not use this pattern due to the requirement of minimizing any changes to existing code. What I needed was a service that could execute any arbitrary code.