I try to run an ASPX page hosted on a Windows Server 2008 x86 through IIS 7.0, with .NET 4.0. I added an application, app1
, to the Default Web Site
of IIS, mapped to dir C:\toto\app1
which contains the Web.config
file.
The error I have is:
Could not load file or assembly 'xxx.dll' or one of its dependencies, etc
and xxx.dll
is a .NET DLL that wraps native C++ DLLs (they are the dependencies that fail to be loaded), all of them are located in C:\toto\app1\bin
. I tried to modify the PATH env variable so that it contained the bin
directory (yes, I know it's bad 🙂 ), but this did not work anyway.
I guess there should be something at IIS application level, but I could not see what… Could you please help ?
Many thanks !
EDIT: copying the native DLLs in C:\windows\system32
actually works, but it's not a pleasant solution at all…
Best Answer
If its not GACd (which it doesn't appear to be), the simple answer is:
You need the external DLL to be in the bin\ directory of the application.
If you have it as a reference in VS2010, select it, go to properties, and set the CopyLocal value to True. Rebuild the application. This should cause that DLL to copy out to the bin and your app can reference without any other work.