0

I have an ASP.NET (C#) web application that loads my dll assembly during run time. It has always worked fine on windows server 2003, but now that we moved over to windows server 2012 I've been getting the error:

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

This is the code that I have:

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");

The error is happening on the second line on Assembly.Load(....);

Any help would be appreciated.

Diogo Rocha
  • 9,759
  • 4
  • 48
  • 52
hmakled
  • 353
  • 4
  • 12
  • Does your code work if you add reference directly in the project? This way you can eliminate the dynamic loading as the problem. – ps. Feb 11 '16 at 22:06
  • I'm not sure I have never tried that. Are you saying to add a reference to my dll? How would I do that and how would I call it? – hmakled Feb 11 '16 at 22:10
  • http://stackoverflow.com/questions/12992286/how-to-add-a-dll-reference-to-a-project-in-visual-studio – ps. Feb 11 '16 at 22:31

0 Answers0