I've a working XML Web service written in ASP.Net. Now I need to reference certain assemblies lying in a specific folder e.g. c:\NotMyCode
I do not want to copy/duplicate zillions of dlls in that folder into my bin folder.
I tried to keep the CopyLocal=false
for the assemblies referred in the Web Service. That ended up in a FileNotFound exception for the assembly.
When I switch to CopyLocal=true
, the referenced DLLs are copied over to the bin folder.. and it works.
So my question here is: How do I reference assemblies that do not lie in my bin folder or a subfolder beneath it ? Do I need to change some security policy files somewhere? I think I'm not the first person to ever want to do something like this.. so I'm assuming someone has already solved this problem.
(I've tried impersonating an admin user in the IIS ASP.net configuration panel, but that didnt work either.)
Update: Can't install it in the GAC either. To give an analogy, this web service is giving a simplified view to a third party app e.g. Starteam. I can't (shouldn't have to.. don't want to..) copy all the binaries in that folder to the bin folder or install it into the GAC
According to the MSDN documentation,
Referenced assemblies outside the application's root directory must have strong names and must either be installed in the global assembly cache or specified using the <codeBase>
element.
So, it might appear that you're out of luck. Here's what I'd try:
linkd SharedCode c:\NotMyCode
. This makes <yourappbase>\SharedCode
effectively be an alias for c:\NotMyCode
.<probing>
element, referencing the junction point SharedCode
. Since this is under your application base, it should work. Alternatively, use AppDomainSetup.PrivateBinPath to set the path probed for assemblies.I'm quite curious to see if this works :-)