开发者

Why does CreateInstanceFromAndUnwrap not work in a web container?

开发者 https://www.devze.com 2023-03-23 02:04 出处:网络
Hi I have code that looks like the following: public static I Load<I>(string appDomainName, string fqDllName, string classType) where I : class

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号