日期:2014-05-18  浏览次数:20367 次

应用程序域创建实例对象,纠结。求救
C# code
 domain = AppDomain.CreateDomain(name, null, AppDomain.CurrentDomain.BaseDirectory, "bin", true);//由于运用程序一定会引用到这个DLL,所以这里直接写死到bin目录下
            Type type = typeof(SmartPluginInstanceFactory);

            //创建工厂实例化
            //factory = (SmartPluginInstanceFactory)domain.CreateInstance(type.Assembly.FullName, type.FullName).Unwrap();//理想化写法

            factory = (SmartPluginInstanceFactory)domain.CreateInstanceFromAndUnwrap(AppDomain.CurrentDomain.BaseDirectory + "bin\\Plugin.dll", "Plugin.SmartPluginInstanceFactory");



这个代码在控制台、CS架构里都能运行,在BS架构下如果是部署到IIS下就不能运行了[启用调试方式生成的端口可以运行]。求解!问题解决加分!

------解决方案--------------------
权限不够,在iis的那个匿名账户映射的那个账户位置上,换一个有权限的账户就可以了
------解决方案--------------------
改 Web.config 
<system.web>
<!--<identity impersonate="true" userName="administrator" password="123"/>-->
------解决方案--------------------
查看下报错日志
------解决方案--------------------
好巧,又一个类似的问题。刚刚我还看见了一个呢。
是因为没有手动的切换AppDomain么?