Problem loading plug-in DLLs with Assembly.LoadFrom()

O

Oenone

I have created a number of "plug-in" DLLs for my ASP.NET application which
are dynamically loaded at run-time. This is done by locating the DLL file on
disk and loading it using the Assembly.LoadFrom(Filename) function.

It's important that the DLLs are shadowed by ASP.NET so that they can be
easily updated. To get this to work I have placed the DLLs into the bin\
directory inside my web application. This seems to work fine.

However, to reduce the clutter of DLLs I would like to put them into a
sub-directory, bin\PlugIns\, but I'm having problems getting this to work.
If I put the DLLs in the new directory and tell my app to load from that
location (specifying the full path:
D:\Work\MyWebApp\bin\PlugIns\MyPlugIn.dll) I get a
"System.IO.FileLoadException: Access is denied" error. The error message
also includes the following:


=== Pre-bind state information ===
LOG: Where-ref bind. Location = D:\Work\MyWebApp\bin\PlugIns\MyPlugIn.dll
LOG: Appbase = file:///D:/Work/MyWebApp
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===
LOG: Private path hint found in configuration file: bin;bin\PlugIns.
LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).
LOG: Attempting download of new URL
file:///D:/Work/MyWebApp/bin/PlugIns/MyPlugIn.dll.


As can be seen, I've tried adding bin\PlugIns to the probing path but it
doesn't make any difference.

Any suggestions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top