Thinh Pham - 119 - Mar 21, 2014

Have anyone ever use the method ServiceStackHost.CreateServiceController()? The reason i’m asking is that there is sometimes a need to regenerate the assemblies using T4 template (when database schema was modified) and i’d like to replace the list of assemblies currently being used by AppHost with a new list of assemblies without bringing down the app pool.

Carlos Mendes:

Hi Thinh,

Did you consider using MEF from Microsoft?

http://stackoverflow.com/questions/10986966/mef-load-plugin-from-directory

In theory it should be possible to monitor a folder and load DLLs in runtime.

Please be aware that my experience with MEF is quite limited. 

Thinh Pham:

Thanks Carlos for your recommendation. My scenario however is a little different. I already know when some dll needed to be loaded or not and do not need to be notified.

The problem is that the AppHost constructor requires that all assemblies to be provided at construction time. If one of my assembly is regenerated at runtime, how do i get the AppHost to refresh itself so new types from the generated assembly get picked up? Without restarting the AppPool or doing an iisreset of course