Worflow service - How to dinamically load referenced assemblies RRS feed

  • Question

  • Hi everyone,
    We developed platform assemblies that are used by our services. Every service .svc file uses our custom service factory that is subscribed on following events

    AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(LoadAssembly);
    AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(LoadAssembly);

    inside our implementation we load required dll from file system. We can not use GAC because of other problems that we have.
    This works fine with wcf services. Services start even though we do not copy platform assemblies inside bin folder, factory loads all required assemblies instead.

    We also have worfklow service. For that workflow service we created our own workflowServiceHost and we configured web.config to use this factory

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true">
            <add  relativeAddress="AdministerTransferServiceArrangementCancelationRequest.xamlx"

    The problem is that workflow service factory does not want to start before all assemblies of classes that are used inside xamlx are not present in bin folder.
    We get this error:

    'Cannot create unknown type '{clr-namespace:...

    Our custom workflow service factory does not even start. This works fine for custom service host, but fails for custom workflow service host.

    Can someone help us with this?

    Indigo Cowboy

    Thursday, September 27, 2012 9:34 AM


All replies

  • Is this being hosted inside of IIS/Azure?

    If so, you can set your AssemblyResolve handler in AppInitialize.

    You can also do some interesting stuff inside of IServiceBehavior.AddBindingParameters.  But that would be if you needed to do some work for each endpoint binding... 

    • Edited by houtexwebdev Thursday, September 27, 2012 2:27 PM
    Thursday, September 27, 2012 2:27 PM
  • HI,

    It is hosted in IIS, not Azure. We use net.tcp binding so global.asax does not work for us.

    We added AssemblyResolve handler in workflow service host factory.

    Where is that AppInitialize method, in which class ?


    Thursday, September 27, 2012 3:23 PM
  • Here you go...


    AppInitialize runs when the AppDomain Starts.

    • Marked as answer by LeoTang Friday, October 5, 2012 8:09 AM
    Thursday, September 27, 2012 3:44 PM