c# - Windows service + Plugins design -
i have windows service. idea execute many different tasks possible. lets have iservicepart interface start() , stop() methods. when service starts search assemblies in directory , find classes implements iservicepart. done, no problem.
the problem:
assembly1.dll candidate iservicepart. needs configuration. example assembly1.dll.config. can copy/paste/rename dll task2.dll , task2.dll.config , create second task service. each of plugins comes 10-20 dll dependencies
1) obvious problem how load configuration, because service host's appdomain different assembly1 , task2.
2) expect issues when try load 2 iserviceparts when depend on same 3rd party assemblies
solution 1 make custom configuration , not use app.config.
solution 2 run each plugin in own appdomain.
what suggestions.
hope explained correctly
===================
reference: similar question here: plugin use own app.config
the way i've done this, involves having each plugin in own app domain. however, codebase property of appdomains continue point root directory service exe located. achieves 2 things:
- the many tertiary dependencies plugins have don't need duplicated. example, can put logger assembly in root folder (with service exe) , plugins can see it. great, because neither wish put logger assembly each plugin subdirectory, nor wish use gac.
all plugins share same app config (the same 1 used service exe). or bad thing, depending on needs. don't forget configsource attribute, can allow put specific config sections seperate config files within plugin subdirectories.
incidentally, i've been using maf plugins.
Comments
Post a Comment