Why does CreateInstanceFromAndUnwrap not work in a web container?
Hi I have code that looks like the following:
public static I Load<I>(string appDomainName, string fqDllName, string classType) where I : class
{
AppDomainSetup appDomainSetup = new AppDomainSetup();
AppDomain appDomain = A开发者_如何学GoppDomain.CreateDomain(appDomainName, null, appDomainSetup);
I retVal = (I)appDomain .CreateInstanceFromAndUnwrap(fqDllName, classType);
return retVal;
}
In my test code (ie not within a web container) it works like a charm and loads assemblies without complaining at all. BUT, then I run it in my application (in a web container, II7/ or the VS2010 dev container) and then it all of a sudden starts complaining about :
"Type is not resolved for member '... , ... , Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'."}"
I have even modified my test case to call the Load() method with EXACTLY the same parameters as the application call and the test code (outside of a web container) works fine while the application code throws the above error.
精彩评论