|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem with using AppDomain/Assembly Loading in Queued ComponentAfter many searches online and cannot find the right solution for my issue, I decided to post my question here. If you can help or know something on this, please give me some hints? Thanks in advance ! ISSUE: I have a queued component ( COM+ serviced component and written in C#) that needs to load my .NET assembly dynamically into the AppDomain. Code goes like this: AppDomain newAppDomain = new AppDomain (); newAppDomain.CreateInstanceAndUnwrap("myClassName","myProjectNameSpace.myClass"); *** Note: myClass assembly is C# and I generated tlb for it and loaded the assembly into GAC and registry (via regasm). *** When running this queued component, I always got error "System.IO.FileNotFoundException: File or assembly name myClassName, or one of its dependencies, was not found." Looks like DLLHOST is looking into C:\WINDOWS\system32\ for my dll while my dll is actually in another directory (Note: the dll of queued component and my assembly are in same bin directory). What needs to be done to avoid this error ? Some error log: System.IO.FileNotFoundException: File or assembly name myClassName, or one of its dependencies, was not found. File name: "myClassName" Server stack trace: at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark) at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark) at System.Activator.CreateInstance(String assemblyName, String typeName) at System.AppDomain.CreateInstance(String assemblyName, String typeName) at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName) at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName) at myClassName.MyMethod..ctor() === Pre-bind state information === LOG: DisplayName = myClassName (Partial) LOG: Appbase = C:\WINDOWS\system32\ LOG: Initial PrivatePath = NULL Calling assembly : (Unknown). === LOG: Application configuration file does not exist. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Post-policy reference: myClassName LOG: Attempting download of new URL file:///C:/WINDOWS/system32/myClassNameDLL. LOG: Attempting download of new URL file:///C:/WINDOWS/system32/xhparser/myClassName.DLL. LOG: Attempting download of new URL file:///C:/WINDOWS/system32/myClassName.EXE. LOG: Attempting download of new URL file:///C:/WINDOWS/system32/xhparser/myClassName.EXE. ============== END ======================= |
|||||||||||||||||||||||