tags:

views:

74

answers:

1

I have a wcf service that uses the .net System.AddIns framework to load assemblies into a seperate process and app domain. To improve performance I want to enable the Cross-Domain FastPath.

According to the documentation I need to add the LoaderOptimizationAttribute attribute to the main method of my host application. However I do not have a main method as I am using a service.

So is it possible to use the attribute? If not then how can I ensure that the addin assemblies are loaded as domain neutral?

Thanks.

+1  A: 

If you are hosting in IIS, you should be gettng "LoaderOptimization(LoaderOptimization.MultiDomainHost)" applied by default, and there seems to be no way to change this that I can find. If you want something else applied, you may need to roll your own host (not that hard for WCF, but certainly not as convenient or feature-rich as IIS hosting).

However, this should load all assemblies as domain-neutral - so it is probably what you want already. Make sure you are not using Assembly.LoadFrom(), as this makes it impossible for appdomains to share the JITed code.

Philip Rieck
Thanks very much. I had read that this was the scenario with asp.net but could find no definitive answer regarding services. Thanks also for the Assembly.LoadFrom tip.
Nigel