Using the LoaderOptimizationAttribute in WCF Service

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

As per the documentation, I need to add the LoaderOptimizationAttribute to the main method of my host app. However, I don't have a main method as I am using the service.

So can the attribute be used? If not, how can I ensure that the addin assemblies are loaded as domain neutral?

Thank.

+2


source to share


1 answer


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



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

+1


source







All Articles