I am implementing a Microsoft Speech Server application built on windows workflow foundation. The app manages other sub apps - users call in and the manager loads the assembly containing the correct application and invokes the workflow.
The problem I'm facing is that speech serve or iis like to lock the assembly into memory, preventing me from overwriting the dll. This makes it a pain to debug the app, but will also be totally unacceptable once the app is deployed to production.
There is no way to manually unload a single specific assembly - assemblies are only unloaded when their parent application domain unloads.
So I am trying to use .net remoting to create a new application domain, load the assembly into that domain, create the workflow object through a proxy, and then I want to pass that proxy around.
This is the code for the type that I am trying to create. It is in the assembly I am trying to load:
public class typeContainer : MarshalByRefObject
{
public static Type workflowType = typeof(mainWorkflow);
}
And here is the code in the manager:
AppDomain newDomain = AppDomain.CreateDomain("newdomain");
System.Runtime.Remoting.ObjectHandle oh = newDomain.CreateInstanceFrom(
@"FullPathToAssembly",
"namespace.typeContainer");
object unwrapped = oh.Unwrap();
So the question is, how can I then access typeContainer.workflowType in the manager? oh.Unwrap() yields a type of _TransparentProxy.