如何在运行时将程序集加载到AppDomain?

时间:2016-02-11 22:01:53

标签: c# asp.net visual-studio-2008

我有一个ASP.NET(C#)Web应用程序,它在运行时加载我的dll程序集。它在Windows Server 2003上一直运行良好,但现在我们转移到Windows Server 2012,我一直在收到错误:

could not load file or assembly 'C:\\Inetpub\\wwwroot\\FrontOffice\\bin\\overlay\\FrontOffice.Edi.Overlay.FORD.dll' or one of its dependencies.

这是我的代码:

AppDomain.CurrentDomain.AppendPrivatePath(AppDomain.CurrentDomain.BaseDirectory + "bin\\overlay");

Assembly.Load("FrontOffice.Edi.Overlay");
Assembly assembly = Assembly.Load("FrontOffice.Edi.Overlay." + tp);
AppDomain.CurrentDomain.ClearPrivatePath();

Type type = assembly.GetType("FrontOffice.Edi.Overlay." + tp + ".Overlay" + tp);

Object[] args = new object[] { hdrRow, ts };

Overlay = Activator.CreateInstance(type, args);
OverlayInfo = type.GetMethod("ProcessSegment");

错误发生在Assembly.Load(....);

的第二行

任何帮助都将不胜感激。

0 个答案:

没有答案